Having major problems with SU / SUDO commands.. PLEASE HELP

I am having problems using the su and sudo comamnds regardless of the syntax I use such as sudo -s or su sudo or su - nothing works and what I mean by that is that I always get wrong password. I two users created on this machine (my home macbook) witch is SysOp and Rico as my account now the admin account (the one created on first book was obviously SysOp).. However whenever I do any kind of su or sudo command it says I am typing the wrong password. Also I have never activated the root account on this machine and what I undertand is that when you don't activate a root account on the machine it use's the default admin account's password when you sudo or su. I think for some reason it somehow forgot my admin (sysop) accounts password. I also noticed on occation even when using the gui when prompted for admin account password when installing a program it doesn't reconize my sysop's account password. NOT ALL the time though only with spasific programs. Is this possible? For some reason is it not using my admin accounts password if not then what could it possibly change it too? Is there some way I can reset this, also could there be problems with the permissions and could that be causing this behavior? In before anyone ask's me yes my sysop (admin) account's password works fine I am able to logon via the gui and I am also able to "su sysop" and it will accept the password in the terminal. So right now whenever I have to use su or sudo command for anything I first have to "su sysop" and once logged onto that admin account use sudo or continue my work in terminal as root. Please help!!!

Thanks

MacBook, Mac OS X (10.5.2), Standard..

Posted on May 31, 2008 11:54 AM

Reply
7 replies

May 31, 2008 3:21 PM in response to OldSkewl

If you want to use sudo you have to be registered in the sudoers file. Normally, standard users are not listed in the file and therefore are not allowed to use sudo. (You will see "<your-username> is not in the sudoers file. This incident will be reported." if you try nevertheless.) So in order to sudo something you have to be logged in as administrator. When you are asked for a password type in the admin's. That's it.

floba

May 31, 2008 4:56 PM in response to OldSkewl

OldSkewl wrote:
So right now whenever I have to use su or sudo command for anything I first have to "su sysop" and once logged onto that admin account use sudo or continue my work in terminal as root. Please help!!!


What you are describing is completely normal, and is how it is supposed to work. By default, non-admin accounts are not permitted to use sudo. You need to first su to your admin account, and then use sudo.

From my non-admin account:

kiraly$ su admin
Password:
bash-3.2$ sudo -s
Password:
root#


This is what I do all the time whenever I want to do an admin or root task from my non-admin account. The only way to use sudo from a non-admin account is to add the account to the sudoers file. This can be done, but I have never done it myself.

May 31, 2008 10:01 PM in response to OldSkewl

Thank you both for your input and prompt response's however I don't think you understand what I mean or I am really ignorant regarding this matter.

I was under the impression that if you do not enable the root user the password for root becomes a negative value so that it will resort to using the machine's admin password instead of root. I realize it doesn't pass on all of priv's of root but it is supposed to allow you to su and enter the admin's password hence allowing you to use some of the needed root priv's. (This is my understanding of this) but when I am in the terminal and su or even sudo both of wich prompt for the root password and I enter the admin's password it says it is the incorrect password. I also could have sworn I was able to use both sudo and su with the admin passwords on my previous install of leopard.

So your saying if I add my accounts username to the /etc/sudoers files I will be able to use those commands and the admin's password will then work? If that was the case when I try to use sudo or su from my normal user account wouldn't it just prevent me from using it rather than stating it is a incorrect password?

Also just to not I wasn't being exactly spasific witch in situtions like this is very important when I try to su it give's me this error: SU: Sorry but it pauses for a second like it knows it is the right password but something is stopping it. I say this because when I purposly enter the incorrect admin password it spits out SU: Sorry without delay...

Also I know there is some kind of problem here because like I said once in awhile it will prompt me for the admin's password in the GUI when I am trying to use a spasific program or install one (not all the time only on very spasific programs) and I will enter the password and it will then come back with the same box asking for the username and password for the admin account. However if I type the wrong password it will say I entered the wrong password. So it gets stuck in this loop of askng for my admin password and will not accept the correct password but rather just ask for it again.

If anyone can please provide more info and correct me if I am wrong about anything nor did I mean to say that anyone was wrong I am simply trying to understand this fully and don't wish to accept what you have said as stone when I wasn't explaining the sitution in full as that's when people misdiagnose things witch is the person who is asking the questions fault nobody else's..

Thanks again for your comments and taking the time to help me

May 31, 2008 11:56 PM in response to OldSkewl

OldSkewl wrote:
I was under the impression that if you do not enable the root user the password for root becomes a negative value so that it will resort to using the machine's admin password instead of root.


No, that's not correct. su is used to log in as another user on the command line. To su to account B, you need to enter account B's password.

sudo is used to run a command as root. If the user running sudo is in the sudoers file, the user must enter his own password. If the user is not in the sudoers file, the user cannot use sudo.
The root password, if it exists, is not used for sudo.

This is all independent of whether or not root login has been enabled. It doesn't matter.

So your saying if I add my accounts username to the /etc/sudoers files I will be able to use those commands and the admin's password will then work? If that was the case when I try to use sudo or su from my normal user account wouldn't it just prevent me from using it rather than stating it is a incorrect password?


Are you sure you are using the correct passwords? Some users confuse the two, and think they enter their own password to su and another user's admin password to sudo, but it's the other way around.

Also I know there is some kind of problem here because like I said once in awhile it will prompt me for the admin's password in the GUI when I am trying to use a spasific program or install one (not all the time only on very spasific programs) and I will enter the password and it will then come back with the same box asking for the username and password for the admin account. However if I type the wrong password it will say I entered the wrong password. So it gets stuck in this loop of askng for my admin password and will not accept the correct password but rather just ask for it again.


That does sound abnormal, but I'm not sure what is causing it. In what programs is this happening? Apple apps? Third party ones? Is it the same programs every time? Do they have the authentication problem all the time?

Jun 1, 2008 1:04 AM in response to OldSkewl

OldSkewl wrote:
if I do add my username in the sudoers file will that give my standard account any elivated privilages that I wouldn't want?


No. When you are listed in the sudoers file you can do sudo with your user-password, that's all. Nothing more, nothing less.

The point is: if you are not the only user of the computer and don't administer it yourself, there is _no way_ for you to run commands that require root privileges - unless you are allowed to by the admin of the system by registering you in the sudoers list.

Usually (when you also are admin of the system) you don't have to edit this file because you can gain root privileges step by step the way Király describes in one of his posts:

From my non-admin account:

kiraly$ su admin
Password:
bash-3.2$ sudo -s
Password:
root#

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Having major problems with SU / SUDO commands.. PLEASE HELP

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.