Install and log on to the SSH service in Ubuntu (SSH remote login)

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.