Debian – How to use sudo when I logged in with a SSH key in PuTTY

debiansudo

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?

Best Answer

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).