top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do I add myself as co-owner of a directory on linux

0 votes
417 views

How do I add myself as co-owner of a directory? I set up a new apache server and need to transfer files to /var/www/html. The problem is, of course, I've denied root login but don't have sufficient privs to login and transfer files under my username.

posted Jun 20, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes
 
Best answer

There are a few ways to go about this. There are lots of ways to control access to files and directories on Linux systems. ;-)

You could create a group with permissions to edit the directory, and add yourself to it:

# create an 'htmleditors' group
groupadd htmleditors
# add 'anthony' to it
usermod -aG htmleditors anthony
# change the directory to be owned by the group
chgrp -R htmleditors /var/www/html
# grant read/write permissions to the group
chmod -R g+rw /var/www/html

Or you can use POSIX ACLs to just give yourself access:

# give 'anthony' Read/Write/eXecute permissions on all files in /var/www/html
setfacl -R -m u:anthony:rwX /var/www/html
# do the same for directories
find /var/www/html -type d | xargs setfacl -R -m d:u:anthony:rwX

You can even combine the two:

groupadd htmleditors
usermod -aG htmleditors anthony
setfacl -R -m g:htmleditors:rwX /var/www/html
find /var/www/html -type d | xargs setfacl -R -m d:g:htmleditors:rwX

See the man pages for the various commands used for more information about what exactly is going on.

answer Jun 20, 2013 by anonymous
0 votes
man chown
man chgrp
man setfacl

generally the files should not be owned by apache and only writeable by the owner, in your case you

from point of security it is very bad if the webserver has write-permissions because it may lead after a small
breach in manipulated files wide opening the doors

answer Jun 20, 2013 by anonymous
Similar Questions
+3 votes

When I configure my google test framework for a 32 bit machine, I can run all my test cases successfully with no unpredictable behavior. But when I configure it for a 64 bit machine & run my test cases, it gives severe & abrupt crashes. It crashes in places where it is not supposed to. I tried debugging the issue but was out of my depths. I am not sure if there is a problem while configuring the google test framework for 64 bit or maybe it does not support 64 bit. Any help would be appreciated. Please feel free to get in touch if any clarity is required regarding the query I have shared.
Note : The same code base works perfect on a 32 bit machine.

0 votes

I have an existing system which contains a LAN connected disk drive. I have added a new computer on which I installed Ubuntu (this is my first linux experience). From the Ubuntu computer I can read the files on the samba connected drive but I can not write to those files. I have tried to change the permissions but can not locate where the drive is mounted. So my question ishow do I change the permissions?

+5 votes
+1 vote

I am using centos and trying to do an rsync of the entire /var directory, but exclude just the /var/www directory.

So far I've tried these approaches:

rsync -avzp --exclude-from=/var/www /var/ /mnt/var/    
rsync -avzp --exclude=/var/www /var/ /mnt/var/

But neither has worked. Can I get a suggestion on how to get this to happen?

+2 votes

I am used to traditional update-rc.d et all.

Now I wonder how to add a a script that used to called by init.d (with start/sop ..) to the new "service start xx" regime.

All the tutorials I found talk about how to use update-rc.d..

...