Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

On Linux, I am logged in as another user, I have added myself to wheel.


I have uncommented the lines of /etc/sudoers

## Allow root to run any commands anywhere 
root    ALL=(ALL)   ALL

## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)   ALL

## Same thing without a password

However, when I create a file e.g.

touch test

the owner and group of file 'test' are:

-rw-r--r-- 1 root  root     0 Jul 28 09:05 test

It seems like I have to run sudo in front of every command, otherwise I get permission denied errors.

How do I go about resolving this?

share|improve this question
What's the permissions of that directory where you do touch test? – ott-- Jul 28 '12 at 17:40
Are you in a root shell when you touch test? – Daniel Beck Jul 28 '12 at 18:26
up vote 3 down vote accepted

You can't resolve it; the system is behaving as expected. The sudoers file controls the sudo command, it does not change the way the kernel interprets file and directory permissions. In order to get the effects of sudo, you must run sudo. What sudo does is run commands as root, so naturally files created by a sudo-run command are owned by root.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .