Proper Permissions in Linux

It is always a bad idea to keep all the files and folders with full permissions (file : 666 and folders : 777) for the sake of getting rid of the errors. Use the below commands to find out all the files and folders with full permission under the account /home/theg :

find /home/theg -type f -perm 666 -print
find /home/theg -type d -perm 777 -print

 

Use the below command to change all the permissions to 755 for all the folders and 644 for all the files :

find /home/theg/ -type d -perm 777 -exec chmod 755 {} \;
find /home/theg/ -type f -perm 666 -exec chmod 644 {} \;

Enjoy !!! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s