Skip to main content

Creating a new SSH user in Ubuntu

You can create a new SSH user on Ubuntu by following these steps:

Log in to your Ubuntu server as the root user or a sudo user.

Open a terminal window.

Use the following command to create a new user:

sudo adduser newusername

Replace newusername with the name you want to give the new user.

Set a password for the new user when prompted.

Add the new user to the sudo group so they have administrative privileges:

sudo usermod -aG sudo newusername

Edit the SSH configuration file to allow the new user to connect via SSH. Open the SSH configuration file with a text editor:

sudo nano /etc/ssh/sshd_config

Find the line that says #AllowUsers and remove the # symbol at the beginning of the line.

Add the new user's username to the end of the line, separated by a space.

Save and close the file.

Restart the SSH service to apply the changes:

sudo service ssh restart

Now you can connect to the Ubuntu server using the new user's credentials.