Linux Permissions

How can I give a user root access to the /var/www/ directory without having to use sudo/su?

I've added the user to the root group, but still can't write to the directory.

---------------------/

Give the group write access to the directory and contents:

# chmod -R g+w /var/www

---------------------/

I understand the use of chmod for a single file or directory, but if you use it ona directory does it replicated down to the sub directories and files? Or do those have to be done independently? Also If I am not the owner of a file can I give myself full permissions to it without giving permissions to the group? Or how can I give another group permissions? Do I first need to take ownership? If so how?

---------------------/

For evident security reason, you cannot modify the file privilege if you are not either the owner or root(administrator).
for recursive (directory and sub-dir) you can use the -R option:
chmod -R 770 /directory
or chmod -R o-rwx /directory

---------------------/

You use 'chown' to change ownership and 'chgrp' to change group of a file/directory.
But you have to have appropriate permission. Basically, if you don't have permission to write to the file/directory, you won't be able to change it's ownership.

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.