How to Create User Account and Connect Ubuntu Linux Server using Username and Password with SSH

In this post, I will explain how to create a new user on a Linux machine and connect to this machine remotely with user information and password. The Linux server machine used in this post has Ubuntu 20.04 version installed.

Bu yazıda Linux makinesinde yeni bir kullanıcı oluşturarak bu makineye kullanıcı bilgisi ve parola ile uzaktan nasıl bağlanılacağını anlatacağım. Bu yazıda kullanılan Linux server makinesi Ubuntu 20.04 versiyonu yüklüdür.

First, we need to have the root user information of the Linux machine for which we will define a new user. Then we connect to the Linux machine with this information and open the terminal screen.

Creating a New User

To create a new user named etem, enter the following commands on the terminal screen and click [ENTER].

$ sudo adduser etem

We enter the password on the screen that comes up.

New password:
Retype new password:
passwd: password updated successfully

In the next step, we will create the new user by either leaving blank or filling in the relevant fields below.

Changing the user information for username
Enter the new value, or press ENTER for the default
	Full Name []:
	Room Number []:
	Work Phone []:
	Home Phone []:
	Other []:

If we want to see the newly created user:

$ cat /etc/passwd
$ grep '^etem' /etc/passwd

We need to edit the sshd_config file so that the user we created can connect with a password without a public key. If this file is not edited, ssh connection request is made from remote terminal screen.

If this file is not edited, you will receive the following warning when ssh connection request is made from the remote terminal screen.

etem@165.29.78.13: Permission denied (publickey).
(base) etemkeskin@192 ~ %

To solve this issue, enter commands,

$ sudo nano /etc/ssh/sshd_config

then, change the statement next to PasswordAuthentication in the sshd_config file to yes as seen the image below.

If you want to give root privilege to the newly created user,

$ adduser etem sudo
$ sudo systemctl restart sshd

You can make the ssh connection with the newly created user information by entering the following commands and password.

$ ssh etem@your-ubuntu-server-ip

Good luck…