In my /var/www folder i have permission 2750 with the owner being root (unless i change it by hand) and the group being www-data.

I mv a folder into /var/www and i'd like to reset the permissions so everything is 2750 and for the group to be www-data, is it possible to do it in one command? or do i need to do multiple cmds? (its two commands, 3 if i want the same owner but it be nice to do it with one for this folder)


You still need two commands, but you can put them on one line:

chmod -R 2750 /var/www/folder && chgrp -R www-data /var/www/folder

The -R will apply the permissions to all the subdirectories and files within /var/www/folder/.

If you do this often, you can put a script with that command into your ~/bin directory and make it executable and just run that.

  • I think i'll do just that thanks and accepted – user3109 Feb 25 '11 at 7:03
  • That will give all files execute permission. – Mikel Feb 25 '11 at 10:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.