SSH in CentOS 6: install - start & stop - enable & disable SSH server


To accept SSH connections, the system must first be running the SSH server.
CentOS 6 installs the SSH server by default, so it is usually not necessary to install it. 


To check if it is installed and running, use the following command:
#service sshd status


An output similar to the following will be generated if the service is installed and running:

“sshd (pid 9488 9486 1850) is running...”


 Should the service not be installed, you can then install all the necessary files with the following command:
(the installation process will download the SSH server, install it and start the service, at the same time)

 #yum install -y openssh openssh-server openssh-clients openssl-libs && service sshd start


Enable SSH Root Login

In order to enable login as root, you may need to modify the main SSH configuration file  “sshd_config” with a text editor of your choice. In our example, we will use vim as an editor.
Note: To edit with vim you use "INSERT" key to go into edit mode, and "ESC" key to exit edit mode, when your editing is done, you have two options to save the file and quit the editor, as follows:

1. Press "ESC" key, and type :wq (yes the colon is included) and hit/press "ENTER"
2. Press "ESC" key, and type :x and hit/press "ENTER"

So to edit the file:
#vi /etc/ssh/sshd_config


Find the following line in the file:
#PermitRootLogin without-password


Remove ‘#’ at the beginning of the line, and change ‘without-password’ to ‘yes’ like in the examples shown below.
#PermitRootLogin without-password


PermitRootLogin yes


After you save the file  with "ESC" :wq or "ESC" :x restart the sshd service.
#service sshd restart

Quick Guide Commands:

Check sshd status
#service sshd status

Install sshd
#yum install -y openssh openssh-server openssh-clients openssl-libs

#service sshd start

Stop sshd
Alert: Do not run the following command if you are connected thru ssh based session, then you will end up getting ‘network connectivity lost'.

#service sshd stop


#service sshd reload


If you think this is too complicated or feel insecure in doing this, you can simply ask our system admins to Enable or Disable root login through SSH on your CentOS server. By opening a ticket or use Live Chat

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to connect to VPS with SSH Using Windows, Linux or macOS

Connecting with SSH (Secure Shell)There are 2 primary ways to connect to a Linux VPS. The first...

SSH in Debian & Ubuntu: install SSH

Install SSH on Debian System #apt-get -y update && apt-get -y install openssh-server...

SSH in CentOS 7: install - start & stop - enable & disable SSH server

OpenSSH Server is available under default yum repositories. We can install or update the latest...