Monday, March 2, 2015

Reset only first level folder permissions

I had a requirement to reset all the home folders permission of FTP users to 750 (To disable Read/Browse permission to 'other' users).

Let's assume the FTP home folder structure is as follows: /ftp/home/<ftpusers> and the syntax to reset the folder permission would be :

# find /ftp/home -maxdepth 1 -type d -exec chmod 750 {} \;

Note: Using -maxdepth 1 wouldn't allow the find command to recurse though sub-folders.