0

I need to add an account for someone to be able to SSH into my server and have sudo privileges. He has given me his pubkey which is something like:

ssh-rsa AAAAfbfi40fdsfodudksjflksjdf..... name@workstation

I'm really not sure what to do with this key. I can find a way to create a new user for SSH but what's the point of this pubkey and how can I use it to make an account for him?

sudo
  • 3
  • 1

1 Answers1

2

You will need to un-comment this line from /etc/sudoers Allows people in group wheel to run all commands

%wheel ALL=(ALL)       ALL

Then these would be the steps to add a user

useradd -d /home/user -G wheel user
mkdir /home/user/.ssh
echo "ssh-rsa dfgsdfgsfdgsdfg" > /home/user/.ssh/authorized_keys
chown -R user.user/home/user/
chmod -R o-rwx /home/user/.ssh

You will need to also ensure the following options are set in the /etc/ssh/sshd_config

  PubkeyAuthentication yes
  AuthorizedKeysfile .ssh/authorized_keys
chrisw9808
  • 309
  • 1
  • 5
  • Firstly thank you for your help! So, in my 'sudoers' file there is not a %wheel anywhere, only root, %sudo, %admin. Also there already is a folder called .ssh and it contains authorized_keys, do I just paste his key at the end of that file? – sudo Jun 24 '15 at 15:17
  • Is this a debian/ubuntu server? If so then this will be the guide you need to use. https://www.digitalocean.com/community/tutorials/how-to-add-delete-and-grant-sudo-privileges-to-users-on-a-debian-vps – chrisw9808 Jun 24 '15 at 15:43