Linux server create new user and ssh login without password

Install SSH server

$ sudo apt update
$ sudo apt install openssh-server

Check Status

$ sudo systemctl status ssh

Start SSH automatically on boot

$ sudo systemctl enable ssh

Client machine side

Generate ssh key pair
This will generate your ssh key pair


This is your public key, this key value need to be exist in the server you connect to.

more ~/.ssh/

Server side

Create new user

adduser myuser
usermod -aG sudo myuser

Change to myuser account

sudo su – myuser

add client public key to authorised_keys file

mkdir ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys

(copy and paste in the value of your public key)

Disable root and password login

sudo nano /etc/ssh/sshd_config

Edit the following directive

PermitRootLogin no
PasswordAuthentication no

Reload the server

sudo systemctl reload sshd
Generate keys
ssh-keygen -t rsa
#create custom key
ssh-keygen -t ed25519 -C "Description"

Copy the key to the server

ssh-copy-id username@server
#copy the custom key to server
ssh-copy-id -i ~/.ssh/ username@server
scp ~/.ssh/ username@server:~/.ssh/id_rsa_[client].pub
sudo cat id_rsa_[client].pub >> authorized_keys

restart SSH service

sudo systemctl restart ssh.service

use the custom key to connect

ssh -i ~/.ssh/custom_key username@server

or use ssh config file

nano ~/.ssh/config
Host ubuntu182
  User username
  Port 2222
  IdentityFile ~/.ssh/custom_key

Log In

How to Use Docker + Webtop to Secure Your Online Activities