-1

How I can run the command the command on the Putty for change the permisions?

I want to set permission for files should be 644 and permissions for folders should be 755 in the publick_html.

Please help me.

  • the folder name should be public_html, and the command should be chmod 755 /var/www/public_html, read the chmod manual: man chmod. – Ravexina Apr 17 '17 at 08:47

1 Answers1

1

Assuming the full directory path is /var/www/public_html (probably not publick_html), this finds all directories (except hidden ones) under it and sets the permissions 755 for them:

find /var/www/public_html/* -type d -exec chmod 775 '{}' \;

To change permissions for all regular files (except hidden ones):

find /var/www/public_html/* -type f -exec chmod 644 '{}' \;

If you are not sure, what find might find, try putting echo before chmod, so the chmod commands only get shown, not actually run, e.g.:

find /var/www/public_html/* -type f -exec echo chmod 644 '{}' \;

If running a command gives you the error "Permission denied", prefix it with sudo, however being extra careful, e.g.:

sudo find /var/www/public_html/* -type d -exec chmod 775 '{}' \;