Link to home
Start Free TrialLog in
Avatar of ainselyb
ainselyb

asked on

Linux command for change owner and group of current directory

Can someone look at the following to see if I have this correct? I am new to Linux. Thanks.

Give commands for changing ownership of all files in the current directory to user and group nobody, and change the permissions so that the owner has read-write access, while group and other users have only read access.
$ su
$ chown R nobody .
$chgrp -R nobody .
$chmod 644 .
$exit
Avatar of jcullins
jcullins

i use the following command myself,

chown -R nobody:nobody <dirname>

so if you wanted to make your /var/www folder owned by user nobody and group nobody you would do

chown -R nobody:nobody /var/www
chmod 644 -R /var/www

SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A quick site to keep in your favorites is the "CHMOD Calculator". It shows both the octal and symbolic file permissions setting.

http://www.ezau.com/latest/tools/chmod.html
find . -type f -exec chown nobody:nobody {} \; <- will change owner of all files in . to nobody, and owner group to nobody
replace f with d so it will execute on all directories

find . -type d -exec chmod 755 {} \; <- will give owner full acces, group read\browse access, other read\browse access to all directories recursivly from your current directory.

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial