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.

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

wheel:x:10:root,allan

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
%wheel  ALL=(ALL)   NOPASSWD: ALL

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
add comment

1 Answer

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
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.