By default, the SSH service is not installed in Ubuntu. If you remotely connect to Ubuntu through SSH, You need to manually Install SSH-server.
To determine whether to install the SSH service, run the following command:
PS-E | grep SSH
The output is as follows:
Zht @ zht-Ubuntu :~ $ PS-E | grep SSH
2151? 00:00:00 ssh-agent
5313? 00:00:00 sshd
Ssh-agent indicates that the ssh-client is started, and sshd indicates that the ssh-server is started.
If sshd is missing, the SSH service is not started or is not installed.
Install the ssh-client command:Sudo apt-Get install OpenSSH-Client
Install the ssh-server command:Sudo apt-Get install OpenSSH-Server
After the installation is complete, start the service: sudo/etc/init. d/ssh start
After starting, you canPS-E | grep SSH"To check whether the instance is correctly started.
The default port of the SSH service is 22. You can change the port and run the following command to open the SSH configuration file:
Sudo gedit/etc/ssh/sshd_config
The configuration file is as follows:
# Package generated configuration file # See the sshd (8) manpage for details # What ports, IPS and protocols we listen for port 22 # package generated configuration file # See the sshd (8) manpage for details # What ports, IPS and protocols we listen
After you modify the port, restart the SSH service to take effect. The command is as follows:
Sudo/etc/init. d/ssh restart
After the SSH service is started, you can log on. The LOGIN command format is:SSH account @ IP Address
For example:SSH test@192.168.135.249
Enter the password for test as prompted to log on remotely.
Exit remote LOGIN command: Exit
Shows the demo: