Back

Contents

Set up a new user in linux

Create new user account

Assuming logged in user has sudo priveleges:

$ sudo useradd -ms rbarnsley

Give user sudo priveleges

$ sudo usermod -aG sudo rbarnsley

then add appropriate line to /etc/sudoers:

$ visudo

%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

Add public key from host to .ssh/authorized_keys

$ sudo su - <new_user>
$ cd ~
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
$ vim .ssh/authorized_keys 

Add the public key to this file.

Alternatively, use ssh-copy-id.


Top