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.

For some reason, I am unable to run any commands with su as my user. This was working before and I'm not sure what broke it. The funny thing is that I can su to root without any problems.

Example:

machine:~ myuser$ who
myuser console  Sep 28 01:10 
myuser ttys000  Oct  3 22:21 
machine:~ myuser$ sudo echo "test"
Password:
su: Sorry
machine:~ myuser$ su
Password:
sh-3.2# echo "test"
test
sh-3.2# exit
exit
machine:~ myuser$

As far as I can tell, my user is part of the appropriate user groups (including wheel and admin):

machine:~ myuser$ groups myuser
staff com.apple.sharepoint.group.1 wheel everyone _appstore localaccounts _appserverusr admin _appserveradm _lpadmin _lpoperator _developer com.apple.access_screensharing
machine:~ myuser$ dseditgroup -o checkmember -n  . wheel
yes myuser is a member of wheel
machine:~ myuser$ dseditgroup -o checkmember -n  . admin
yes myuser is a member of admin

I am stumped. Does anyone have any ideas on how to get this working again?

Many thanks in advance.

share|improve this question
3  
Wait, aren't you supposed to use sudo to run commands, and su to switch users? At least, that's what I always did in Linux (not an OS X user, though I assume it's the same)... –  Bob Oct 5 '12 at 18:07
2  
I agree with @Bob. sudo is used to execute a single command as another user (ie: root) while su is used to log in as another user entirely. –  UtahJarhead Oct 5 '12 at 18:08
    
Argh! You're right guys, sorry about that. The same problem exists when using sudo though; I will update my question. –  Leif Oct 5 '12 at 18:12
1  
Argh, I'm such a noob! I got it now. I was using the wrong password for sudo. Sudo uses the admin password; not the root password. –  Leif Oct 5 '12 at 18:17
add comment

1 Answer

up vote 3 down vote accepted

Use sudo to execute a single command and use su to log in as another user.

share|improve this answer
    
Thanks Utah, this is definitely correct. However, I still have the same issue when using sudo to run single commands from my user. I've updated my question accordingly. –  Leif Oct 5 '12 at 18:15
    
Got it! I was using the wrong password (root password, instead of admin password). I will accept this as the answer, since it put me onto what I was doing wrong. Thanks again! :) –  Leif Oct 5 '12 at 18:17
    
My pleasure, sir. –  UtahJarhead Oct 5 '12 at 18:23
1  
@Leif Specifically, it's not the "admin" password, but rather the password of the current user who is executing the command (who will usually also need to be an administrator). –  Darth Android Oct 5 '12 at 18:35
    
Perfect, thanks for the clarification @DarthAndroid! –  Leif Oct 5 '12 at 18:41
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.