Installing OpenSSH server on Ubuntu
First of all, check if SSH is already installed.
ssh -V
Make sure that your database for packages is up to date.
sudo apt update
Install the OpenSSH by executing the following command:
sudo apt install openssh-server
You can check that the OpenSSH server is actually running.
sudo systemctl status sshd
Enabling OpenSSH server on system boot
If you want the OpenSSH server to start on system boot, you should enable the ssh service.
sudo systemctl enable ssh
Configuring OpenSSH server on Ubuntu
The configuration file for the OpenSSH server is /etc/ssh/sshd_config.
vi /etc/ssh/sshd_config
Changing default port for the OpenSSH server
In /etc/ssh/sshd_config file, search for the following line:
#Port 22
Change the port to a desired one. For example:
Port 4422
Restarting OpenSSH server to apply the new settings
Apply the changes in /etc/ssh/sshd_config file to OpenSSH server by executing the following command:
sudo systemctl restart sshd
Stopping OpenSSH server
To stop the OpenSSH server, execute the following command:
sudo systemctl stop sshd
How to connect to OpenSSH server
The command syntax:
ssh -p <port number> <user account>@<server IP address>
or
ssh -p <port number> <user account>@<server hostname>
For example, you can run a command like this:
ssh -p 4422 foo@192.168.1.123
6 replies on “How to install and use OpenSSH server on Ubuntu 20.04”
I need to to thank you for this great read!! I certainly loved every bit of it. I have got you book-marked to look at new things you postÖ
Hi, I wanted to know your price.
Very nice article. I definitely appreciate this site. Keep it up!
Happy everyday!
人生不如意十之八九,开心最重要!
不知道说啥,开心快乐每一天吧!