-1

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?

3 Answers 3

1

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.

0
1

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

3
  • I've tried that many times and it isn't working!
    – Icode4food
    Nov 14, 2011 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, 2011 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, 2011 at 17:28
1

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.

1
  • 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.
    – user9517
    Nov 14, 2011 at 17:57

You must log in to answer this question.

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