Re: [bitfolk] Adding a new user

Top Page

Reply to this message
Author: Samuel Bächler
Date:  
To: users@lists.bitfolk.com
Subject: Re: [bitfolk] Adding a new user
Hi Andres

On 14/09/2021 10:01, Andres Muniz wrote:
> Hi all,
>
> Hopefully an easy one I can get help with.
>
> I would like to add a new user to the server.

There are two commands adduser and useradd. According to the manpage
(man useradd) it is more convenient to use adduser.
>
> I found the following guide works for me:
>
> https://thucnc.medium.com/how-to-create-a-sudo-user-on-ubuntu-and-allow-ssh-login-20e28065d9ff
> <https://thucnc.medium.com/how-to-create-a-sudo-user-on-ubuntu-and-allow-ssh-login-20e28065d9ff>
>
>
> Is there a gotcha that will cause a problem down the line?
>

As it comes to keys see below how I usually do it - on debian though

***** Create Key

me@client:~$ ssh-keygen -t rsa -b 4096 -C "mykey"
me@client:~$ ls -l ~/.ssh | grep mykey*
    -r-------- 1 me me 3326 Dec 31 12:46 mykey
    -r-------- 1 me me  744 Dec 31 12:46 mykey.pub

***** Deploy Key

me@client:~$ ssh USER@HOST "echo \"$(cat ~/.ssh/public-key.pub)\" >>
.ssh/authorized_keys"
me@host:~$ ls -la | grep ssh
    drwxr-xr-x 2 me  me  4096 Dec 31 11:53 .ssh
me@host:~$ ls -l .ssh/authorized_keys
    -rw------- 1 me me 744 Dec 31 11:55 .ssh/authorized_keys

***** Edit /etc/ssh/sshd_config on Host

Change

    PasswordAuthentication yes

into

    PasswordAuthentication no

Then do 'systemctl restart ssh.service'

Regards,

Sam