Wednesday 13 April 2016

How to create an SSH-only shell account in Ubuntu

Because I keep forgetting.
$ sudo adduser --gecos 'Fred Smith' --disabled-password fred
$ cd /home/fred
$ sudo mkdir .ssh
$ sudo cp ~/fred.public.key .ssh/authorized_keys
$ sudo chmod 0700 .ssh
$ sudo chown -R fred.fred .ssh
If Fred's public key starts "BEGIN SSH2 PUBLIC KEY" then turn it into the one-line form first.

No comments:

Post a Comment