After installing the Ubuntu server or desktop, you have a question: Is SSH enabled by default on Ubuntu? Then the answer is absolutely ‘NO‘. The user or administrator has to install or enable the SSH manually by triggering just a one-line command which we will show in this article. But before that let’s see what is SSH?
The Secure Shell (SSH) is a protocol which allows us to connect the Ubuntu server or desktop remotely through a secure channel. It allows running all commands remotely those we can run physically on the server. Even the user can run command line and graphical programs, transfer files, and even create secure virtual private networks over the Internet. It is developed by the IETF’s Network Working Group and more reliable protocol that provides security for remote login sessions and other network services. SSH was originally a program on a UNIX system and later quickly expanded to other operating platforms. The SSH client is available on multiple platforms including Linux, Solaris, Windows, MacOS and others.
Here we let you know how to enable the SSH on Ubuntu (18.04, 17.04, 16.04, 14.04 …) or Linux Mint.
- Open the Command terminal on Ubuntu server or desktop.
- To open the command terminal in the graphical mode the user can use the shortcut CTRL+ALT+T
- Log in as a standard user or root. For root one can use sudo -i
- Run the command: sudo apt-get install ssh
- The above command will install three packages: OpenSSH-client, OpenSSH-server, and OpenSSH-SFTP-server.
- Once the SSH server installed, use this command to enable it on Ubuntu: sudo service ssh start
- Now check the status of the SSH server on Ubuntu using: sudo service ssh status
If you want to edit some settings of SSH such as listening port, root login permission and more that can be done by editing the configuration file via this command:
sudo nano /etc/ssh/sshd_config
The output of all the above commands:
h2s@DESKTOP-N53EEI1:~$ sudo apt-get install ssh [sudo] password for h2s: Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libgsoap-2.8.60 libvncserver1 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: openssh-client openssh-server openssh-sftp-server Suggested packages: keychain libpam-ssh monkeysphere ssh-askpass molly-guard rssh The following NEW packages will be installed: ssh The following packages will be upgraded: openssh-client openssh-server openssh-sftp-server 3 upgraded, 1 newly installed, 0 to remove and 174 not upgraded. Need to get 997 kB of archives. After this operation, 106 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 openssh-sftp-server amd64 1:7.6p1-4ubuntu0.3 [45.6 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 openssh-server amd64 1:7.6p1-4ubuntu0.3 [333 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 openssh-client amd64 1:7.6p1-4ubuntu0.3 [614 kB] Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 ssh all 1:7.6p1-4ubuntu0.3 [5204 B] Fetched 997 kB in 5s (197 kB/s) Preconfiguring packages ... (Reading database ... 99318 files and directories currently installed.) Preparing to unpack .../openssh-sftp-server_1%3a7.6p1-4ubuntu0.3_amd64.deb ... Unpacking openssh-sftp-server (1:7.6p1-4ubuntu0.3) over (1:7.6p1-4) ... Preparing to unpack .../openssh-server_1%3a7.6p1-4ubuntu0.3_amd64.deb ... Unpacking openssh-server (1:7.6p1-4ubuntu0.3) over (1:7.6p1-4) ... Preparing to unpack .../openssh-client_1%3a7.6p1-4ubuntu0.3_amd64.deb ... Unpacking openssh-client (1:7.6p1-4ubuntu0.3) over (1:7.6p1-4) ... Selecting previously unselected package ssh. Preparing to unpack .../ssh_1%3a7.6p1-4ubuntu0.3_all.deb ... Unpacking ssh (1:7.6p1-4ubuntu0.3) ... Processing triggers for ufw (0.35-5) ... Processing triggers for ureadahead (0.100.0-20) ... Processing triggers for systemd (237-3ubuntu10.3) ... Processing triggers for man-db (2.8.3-2) ... Setting up openssh-client (1:7.6p1-4ubuntu0.3) ... Setting up openssh-sftp-server (1:7.6p1-4ubuntu0.3) ... Setting up openssh-server (1:7.6p1-4ubuntu0.3) ... Creating SSH2 RSA key; this may take some time ... 2048 SHA256:5AdbGb5TQhr0muu4hOz49gdBC8iRRqonYXv0s0JUUHE root@DESKTOP-N53EEI1 (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:m1ibvVu6wqieTG8Yd98ocAHv3X6XqYCuhx56zq7Jgzc root@DESKTOP-N53EEI1 (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:SF2xPgLXsCG1Z6yEF7/+wrqTxxptiyuimxgnC7XVpwc root@DESKTOP-N53EEI1 (ED25519) invoke-rc.d: could not determine current runlevel Setting up ssh (1:7.6p1-4ubuntu0.3) ... h2s@DESKTOP-N53EEI1:~$ sudo service ssh status * sshd is not running h2s@DESKTOP-N53EEI1:~$ sudo apt-get install openssh-server Reading package lists... Done Building dependency tree Reading state information... Done openssh-server is already the newest version (1:7.6p1-4ubuntu0.3). The following packages were automatically installed and are no longer required: libgsoap-2.8.60 libvncserver1 Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 174 not upgraded. h2s@DESKTOP-N53EEI1:~$ sudo service ssh start * Starting OpenBSD Secure Shell server sshd [ OK ] h2s@DESKTOP-N53EEI1:~$ sudo service ssh status * sshd is running h2s@DESKTOP-N53EEI1:~$
Other useful tutorials:
- How to access Windows system files from Ubuntu subsystem Linux terminal
- Install Comodo Antivirus for Linux via command line on Ubuntu