Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I do that? I got user amira on my Ubuntu 11.4, I want him to able to see / read / write a root user files such as /etc/* and apache files

share|improve this question
    
are you asking this in relation to permissions for an apache instance or for permissions for a normal user on your system? –  Rinzwind Aug 28 '11 at 14:08

2 Answers 2

up vote 1 down vote accepted

The normal way to do this is to add that user to the sudoers file. You can do that this way:

  • Open a terminal and type

    sudo su
    
  • After entering your admin password type

    visudo
    
  • Using the arrow keys, navigate to the bottom of the sudoers file that is now displayed in the terminal

  • Just under the line that looks like:

    root ALL=(ALL) ALL
    
  • Add

    amira ALL=(ALL) ALL
    
  • Now press Ctrl+X and press Y when prompted to save

User amira can now use sudo to edit file, permissions and anything an admin user (like the one you used installing your Ubuntu) is capable of doing.

share|improve this answer
    
For reference: the first two commands can be replaced with one: sudo visudo (or sudo -e /etc/sudoers but that looks more complicated). –  David Andersson Aug 28 '11 at 21:08
    
The answer is technically correct, but that's not the best solution to what he's asking for. He should use filesystem permissions for that. Recommending that you give someone root access in order to edit an HTML file is a very bad advise. -1 –  Jo-Erlend Schinstad Aug 28 '11 at 23:49
    
No it is not Jo-Erlend. His question is ambigous. –  Rinzwind Aug 29 '11 at 6:34
    
Yes, people have a tendency not to ask about things that they already know. And when they ask about things they do not know, they often do not phrase the question fitting the obvious answer. Sometimes you have to provide an answer to what the user wants and not what he asks for. –  Jo-Erlend Schinstad Aug 29 '11 at 16:40

You should probably change the ownership of the relevant files and folders. For instance, if you have a website which files are in /var/www/amira, then you could set the files and folders to belong to www-data:amira. Then you would allow that group to edit files and add users to that group. The amira user would already have that group as its primary group. This is a much better approach than saying a user can edit all roots files since you can then limit which files are editable by who. If amira got hacked, then the website would be editable by the hacker, but your openssh-server would still be safe, for instance.

share|improve this answer
    
If amira gets hacked he's got bigger problems than his website being compromised. My method is not different than the NORMAL way Ubuntu uses accounts and his normal account used to install his system is set. –  Rinzwind Aug 29 '11 at 6:37
1  
It is vastly different. A sudoer can delete system files by mistake, for instance. It is quite simply wrong to give a user absolute power in order to do a very simple thing that in no way requires root access. –  Jo-Erlend Schinstad Aug 29 '11 at 16:37

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.