Create a new user in ubantu system, Xshell remote connection

To create a new user on Ubuntu system and connect remotely using Xshell, you can follow the steps below:

  1. Create a new user on the Ubuntu system:

Open a terminal or log into the Ubuntu server using SSH.
Create a new user with the following command (replace "new_user" with your desired username):

sudo adduser new_user

Follow the prompts to set the password and other relevant information for the new user.

  1. Grant the new user sudo privileges (optional):

If you want the new user to have administrator privileges, add them to the sudo group, enabling them to perform privileged operations.
Add a new user to the sudo group with the following command (replace "new_user" with the username you created):

sudo usermod -aG sudo new_user

3. Install and configure the SSH server:

If you have not installed SSH server on your Ubuntu server, you can install OpenSSH server with the following command:

sudo apt update
sudo apt install openssh-server

  1. Make sure your firewall allows SSH connections (optional):

If a firewall is enabled on your Ubuntu server, you need to make sure that inbound traffic for SSH connections is allowed.
Open the SSH port (22 by default) with the following command:

sudo ufw allow ssh

  1. Find the IP address of the Ubuntu server:

Find your Ubuntu server's IP address with the command:

ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'

  1. Use Xshell to connect remotely:

Open the Xshell software and click "New" to create a new session.
In the "Session Properties" window, fill in the following information:
Protocol: SSH
Host: The IP address of the Ubuntu server
Port: The default is 22 (if you have changed the port of the SSH server, please fill in the corresponding port)
Username: The username of the new user you just created
Password: The password for the new user
Click "OK" to save the session properties.
On the main interface of Xshell, select the saved session, and click the "Open" button to connect.
If everything is set up correctly, Xshell will connect to the new user account on the Ubuntu server.
Note that for security reasons it is recommended to disable SSH password login and enable public key authentication. This can improve the security of the system.

Guess you like

Origin blog.csdn.net/weixin_44229976/article/details/130720692