CentOS Linux: Start / Stop / Restart SSHD Command

by on January 3, 2013 · 0 comments· LAST UPDATED March 9, 2014

in , , ,

I'm a new CentOS Linux server user. How can I start, stop, or restart the OpenSSH (SSHD) server on a CentOS Linux? How can I start SSHD on boot time on a CentOS Linux?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsNone
Estimated completion time2m
You need to use the following two commands:

  1. service command - Stop, start, restart or find the status of system services.
  2. chkconfig command - Turn on or off services on boot time.

sshd service name a CentOS Linux

The name of the service is also sshd and usually controlled by /etc/init.d/sshd script or service command.

CentOS turn on OpenSSH SSHD server on boot time command

The syntax is as follows to turn on SSHD on boot time:

 
# chkconfig sshd on
 

To turn off service on boot time, enter:

 
# chkconfig sshd off
 

To see the current status of service in each run-level type:

 
# chkconfig --list sshd 
 

Sample outputs:

sshd           	0:off	1:off	2:on	3:on	4:on	5:on	6:off

CentOS start sshd service command

The syntax is:

 
# service sshd start
 

OR

 
# /etc/init.d/sshd start
 

CentOS stop sshd service command

The syntax is:

Alert: Do not run the following command over ssh based session and you will end up getting 'network connectivity lost' error.

 
# service sshd stop
 

OR

 
# /etc/init.d/sshd stop
 

CentOS restart sshd service command

The syntax is:

 
# service sshd restart
 

OR

 
# /etc/init.d/sshd restart
 

CentOS find status of the sshd service command

The syntax is:

 
# service sshd status
 

OR

 
# /etc/init.d/sshd status
 

Sample session outputs from the above commands

Fig. 01: service and chkconfig command in action

Fig. 01: service and chkconfig command in action

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as: , , , ,

Previous Faq:

Next Faq: