How can you copy a folder to /var/www without sudo?
My folder codes
has the following permissions at /var/www
4 drwxr-xr-x 8 root root 4096 2009-08-09 03:01 codes
I can only sudo cp -r ~/Dropbox/codes/ /var/www
to copy the files.
I cannot copy them without sudo.
Best Answer
Owning
/var/www
yourself might conflict with other options on your system. On my Debian system I would do thisIf the directory is group writable and sticky, all files created in
/var/www
will be writable by anyone in thewww
group, no matter who or what creates them there. (Caveat: they have to be created by "normal" means;cp -a
can circumvent the group sticky bit.)Because Unix is insanely stupid about group membership, for your membership to be honored you will have to log in again, e.g.,
ssh localhost
or log out and log back in. A nuisance.