Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have logged in as "userc". I need access to all the files that "usera" has. I have edited the following file,

vi /etc/group


But this does not seem to work. I am still getting "permission denied" error. If I su to usera then I am able to access those files.

What is the best way to have equivalent access to "root" or "usera"?

Update: I have tried the options suggested in the answer but I am still getting the following:

[root@app company]# cd /opt/company/
[root@app company]# chmod 777 emboss/
[root@app company]# su shantanu
[shantanu@app company]$ whoami
[shantanu@app company]$ echo "test" > /opt/company/emboss/todel.txt
bash: /opt/company/emboss/todel.txt: Permission denied
[shantanu@app company]$ sudo echo "test" > /opt/company/emboss/todel.txt
bash: /opt/company/emboss/todel.txt: Permission denied
[shantanu@app company]$ sudo -u usera echo "test" > /opt/company/emboss/todel.txt
bash: /opt/company/emboss/todel.txt: Permission denied
share|improve this question

closed as off topic by MDMarra, Scott Pack, EEAA, Ward, petrus Aug 26 '12 at 16:21

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

Answer to What is the best way to have equivalent access to "root" or "usera"?

By default you can use sudo command to execute command as root.

Something like following.

edit /etc/sudoers file and add following line

userc ALL=(usera) NOPASSWD:ALL ## remove NOPASSWD: if you want to enable user authentication

Then user userc should be able to use sudo to run things as user usera with the -u option without entering usera's password.

now sudo allows userc to execute command as usera. The real and effective uid and gid are set to match those of the target user(usera) as specified in the passwd.

sudo -u usera command
share|improve this answer

The files are likely set with no group access (either for the files or the directory) or belong to another group altogether. What are the permissions for the relevant files/directories? (ls -l).

share|improve this answer

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