rename conf to key, write inside dir and chmod