How to configure OpenSSH Server

OpenSSH (also known as OpenBSD Secure Shell) is a suite of secure networking utilities based on the Secure Shell (SSH) protocol, which provides a secure channel over an unsecured network in a client–server architecture.

Run from the terminal and type the following command to update the package database as the root user. For the difference between these commands below, see differences between Linux system Update, Upgrade, and Dist-upgrade.

# apt-get update
# apt-get upgrade

Now install OpenSSH server by typing the following command:

# apt-get install openssh-server
After installation, by default
By default openssh will run on the TCP port 22. You can verify the same with the following command:
# netstat -tulpn | grep :22

How to configure Secure OpenSSH Server from the default port

You need to edit the /etc/ssh/sshd_config file using any of the text editors such as nano,

simply run:
# vi /etc/ssh/sshd_config

How Do I Start / Stop / Restart OpenSSH Server in Linux?

Type the following commands as a root user:

# service ssh stop
# service ssh start
# service ssh restart
# service ssh status


# /etc/init.d/ssh stop
# /etc/init.d/ssh start
# /etc/init.d/ssh restart
# /etc/init.d/ssh status

Relevant link:

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x