Linux virtual machine configuration ssh remote connection detailed steps (nanny level tutorial)

1. Configuration environment:

        1、VMware Workstation Pro

        2、ubuntu-18.04.1-desktop-amd64

        3. Xshell7 or SecureCRT8.3

2. Tool download

         The tools used can be downloaded from the official website. Skip the environment installation process here.

3. Configuration process

        1. Turn on the virtual machine

        2. Set the virtual machine to NAT mode:

        Click Virtual Machine->Configuration->Network Adapter. Select NAT mode, OK. 

        3. Check whether the virtual machine is configured with SSH

 /etc/init.d/iptables start

         Execute the above command, if the error is reported as shown in the figure below, SSH is not configured

        

        4. Configure SSH

        Execute the following command to configure SSH

~$ sudo apt install openssh-server

       5. Restart the ssh server

~$ sudo service ssh restart

        6. Open the default port number

~$ sudo vi /etc/ssh/sshd_config 

        Remove the "#" circled in the picture below, and change the prohibit-password to yes. If it should not be yes, the virtual machine does not allow the root user to log in.

        After modification: wq save

        7. Then restart the ssh server

~$ sudo service ssh restart

        8. Obtain IP address

~$ ifconfig

         9. SSH remote connection, connect the IP address obtained in the above picture with xshell 7 or SecureCRT8.3

As shown in the picture below, I am connected with xshell 7.

 

 If the connection fails after entering the password, it means that the password length set by your root user is less than 6. Therefore, the root password needs to be changed. Enter the following command to change the password. After the modification is successful, restart the SSH server and log in again.

sudo passwd root

 In this way, the SSH remote connection is configured. I hope this article can help you.

Guess you like

Origin blog.csdn.net/m0_64655190/article/details/130569010