Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm logging into my CentOS server using key authentication. I'm attempting to sudo a command but I don't know what the password is! How can I find this?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Normally sudo expects is the user account password, unless the rootpw setting has been added to the defaults in the sudoers file. The account password is not the passphrase used to unlock the ssh key unless you set them to be the same.

If you know the password for the account you logged in to then try that. If you don't then you are stuck unless there is some way of changing that password using cPanel.

share|improve this answer
    
I think that means I am stuck. Thanks anyway! –  Icode4food Nov 14 '11 at 19:58
add comment

It's whatever password you put on the key when you generated it with ssh-keygen.

share|improve this answer
    
I've tried that many times and it isn't working! –  Icode4food Nov 14 '11 at 17:22
    
In that case, could you be a great deal more specific about what you're doing and how it's failing. Could we see where things are going wrong? If it really is in the login phase, how confident are you that this key has been correctly installed on the server? –  MadHatter Nov 14 '11 at 17:26
    
The key was created using Cpanel and then downloaded and I am using it to ssh to my server using putty.exe. When I log into the server I am asked to put in the password I supplied when generating the key in Cpanel and I can log in with no problem. –  Icode4food Nov 14 '11 at 17:28
add comment

IF you saying that you are logging into the host using public key authentication, and that you now want to sudo....you are asking what the password you should use for the sudo command.

Sudo and login and functions that are not connected at all to each other really.

The DEFAULT configuration of sudo (probably distro dependent) if I recall requires the ROOT password. So what ever the root password currently is, then that is what to use for sudo.

IF you have changed the default sudo configuration to use the account holders' password, then what sudo is requesting is the password assigned to the account. This would have to be assigned to the account by probably the root user or maybe via the account hold via the passwd command.

share|improve this answer
1  
By default I've never had to supply the root password to sudo something. It's normally my user password. Asking for the root password is configured by adding rootpw to the defaults section of sudoers. –  Iain Nov 14 '11 at 17:57
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.