Set permission to files, folders and subfolders in Shell


Hi,

I  searched google to find out the exact shell command for setting permission to files , folder and all sub folders in one command :

Normally in web Server all folders and sub folders would have 755 permission  Write in your shell.

Command : $ find /var/www -type d -perm 777 -print -exec chmod 755 {} \;

If you want to set all files  permission 644 those have 777 , write in shell:
Command : find /var/www -type f -perm 777 -print -exec chmod 644 {} \;

Ref :http://www.cyberciti.biz/faq/howto-apply-conditional-recursive-chmod-file-permissions/

Advertisements

, ,

  1. Leave a comment

Leave a Reply

Please log in using one of these methods to post your comment:

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

%d bloggers like this: