SSH is a security protocol, mainly used to encrypt remote login session data and ensure the security of data transmission. In this article we will tell you how to install and configure SSH service on Ubuntu and how to connect the ssh server from MacOS, Linux and Windows use ssh client.
1. Check Whether SSH Service Has Been Installed Or Not.
- Open a terminal and run
ps -ef|grep sshdto check whether ssh service is running or not. If you do not see the red line below, that means the ssh service is not running.
[email protected]:~$ ps -ef|grep sshd root 706 1 0 08:46 ? 00:00:00 /usr/sbin/sshd -D
sudo service ssh startto check whether ssh has been installed. If you get the Unit ssh.service not found error message, that means ssh service do not installed.
[email protected]:~$ sudo service ssh start [sudo] password for jerry: Failed to start ssh.service: Unit ssh.service not found.
2. Install SSH Service In Ubuntu.
sudo apt-get updatein above terminal to update all ubuntu source package list.
sudo apt-get install openssh-serverto install ssh server in ubuntu.
- After installation, you can run
ps -ef|grep sshdto check whether ssh service is running.
- If ssh service is not running, run
sudo service ssh startto start it.
3. Connect SSH Service From MacOS & Linux.
- Before you can connect the ssh service, you should run
ifconfigto get the machine ip address. If you install the ssh in a ubuntu virtual machine use virtualbox, you can read article How To Install Ubuntu On Virtualbox Mac
- If you connect the ssh service from MacOS or Linux, you can run below command in terminal to connect the ssh service.
192:~$ ssh [email protected] [email protected]'s password: Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64) ...... Last login: Sun Sep 30 19:39:22 2018 from 127.0.0.1 [email protected]:~$
- The ssh service default port number is 22, you can run
sudo gedit /etc/ssh/sshd_configto edit ssh service configuration file to change ssh service settings.
4. Connect SSH Service From Windows.
- Download putty and install it. Putty is a famous windows ssh client tool.
- Double click the putty icon to start it.
- Input ssh ip and port number in the opened putty dialog, do not forget select SSH radio button in Connection type section. Then click Open button to connect to the ssh server.
- Input user name and password in the popup window, then you can see below picture after successfully login.