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 know the title probably doesn't even make sense, but anyway. I downloaded PuTTY and set it up, and followed this tutorial to set up SSH keys so I don't have to input a user or password when logging in with SSH. I noticed that when I made a new user I used the --disabled-password parameter, since I wouldn't be needing it... but now when I give the user sudo powers I can't proceed as it asks me for the user's password, and I don't have one.

What do I do?

share|improve this question
    
ask for passwordless sudo –  dmourati Apr 8 '12 at 22:47
    
What you do depends on what you want to happen, which you didn't tell us. –  David Schwartz Apr 9 '12 at 0:05

3 Answers 3

up vote 2 down vote accepted

You just have to configure sudo to don't ask password:
In the file /etc/sudoers you have some lines starting with username or groupname (groupnames start with a '%'). Choose the desired line and add the NOPASSWD option. Example:
%sudo ALL=(ALL) NOPASSWD: ALL
This will allow every user belonging to the group named sudo to use sudo without password.
BEWARE: mistakes are easy !

For more informations, see man sudoers

You can edit /etc/sudoers by hand, but it is advised to use the visudo command (wich will lauch a text editor, and once you quit will check the file for correctness. If anything fail, the file remain untouched).

share|improve this answer

Disable password authentication in /etc/ssh/sshd_config

PasswordAuthentication no

Restart sshd.

Then set a password for the user. As you created the user you have root access, so as root

passwd user
Changing password for user user.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

This will then allow you to sudo.

share|improve this answer

Can you login as root and set the password?

Here's how you should have done it:

  1. Generate SSH Key
  2. Make sure you can login with ssh key
  3. Make sure you can sudo to root
  4. Disable passwordauthentication in sshd_conf
  5. Disable root login in sshd_conf
share|improve this answer

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.