Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have directory

drwxr-xr-x 20 root root  4096 Aug 11 17:05 webapps

now I want to allow myself (dims) to write to this directory.

bash-3.2$ groups dims
dims : web2 users

How to accomplish this? Should I add myself to group "root"? Or may be I should change group ownership to a directory?

I don't want to compromise access and make dims root equivalent.

share|improve this question
1  
Just change the ownership of the folder. You shouldn't as yourself to the root group unless you always want root permission. You can change the group and user of the folder with the respected commands. You could also simply provide the permission by 777 the folder. –  Ramhound Aug 14 '13 at 16:17
add comment

3 Answers

You can change the group owner of the folder to 'wheel' like so:

# chgrp wheel -R webapp

Then add yourself (dims) to the 'wheel' group like so:

# vi /etc/groups`  // (or whichever editor you prefer)
...
`wheel:x:10:root,dims`  //(edit this line. It may defer on your system. just add (dims) to that line
...

and save. Make sure the group has write permissions on the folder like so:

# chmod g+w -R webapp
share|improve this answer
add comment

1) chmod 777 webapps

Then every one can read, write and execute – a dangerous way but not for your local directories.

2) chown dims:dims webapps

Now this directory is yours, and you can play with it, changing permissions for instance.

share|improve this answer
    
Ok, suppose currently directory is www:www, not root:root. If I change the ownership, I will brake service access to it! –  Dims Aug 14 '13 at 18:42
    
Ok, use "su -" in redhat base OSs to get root access for your works OR join your userid in www group. –  Sepahrad Salour Aug 14 '13 at 18:57
    
You could add yourself to the www group. –  supercheetah Aug 14 '13 at 19:20
    
Does this depend on whether www is primary or supplementary group? –  Dims Aug 14 '13 at 21:19
    
chown dims:www webapps then chmod 775 webapps (or whatever permissions are appropriate in your particular case). –  Michael Kjörling Aug 15 '13 at 10:58
add comment

In my opinion, the best way to achieve this is to use ACL (Access Control List), depending on your distribution, this will be enabled by default, if this is not the case, you should follow the instructions on your distribution wiki/help.

Then, once your partition is mounted with ACL option you can use the following to add write permission:

setfacl -m u:dims:rwx webapps
setfacl -m d:u:dims:rwx webapps
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.