In this article, I will show you how to start and enable sshd service in OpenSUSE Linux. Sometimes when you try to connect your Server through ssh protocol on Port 22, you won’t be able to connect because sshd service is not yet started or not running. Even if you start the sshd service and then if you restart your server and try to again connect your server on ssh port 22 then you find that you are again not able to connect. This happens when you forgot to enable your service. In this article, I will guide you through the steps to start and enable sshd service so that you can connect your server even after restart.
How to Start and Enable SSHD Service in OpenSUSE Linux
1. How to Start SSHD Service on OpenSUSE Linux
To start sshd service on OpenSUSE Linux you need to use
systemctl start sshd command as shown below. Alternatively you can also use
service sshd start command to start the sshd service.
2. How to Enable SSHD Service on OpenSUSE Linux
To enable sshd service on OpenSUSE Linux you need to use
systemctl enable sshd command as shown below. After enabling the service if you reboot the Server it will start automatically. You don’t have to manually start the Service after every reboot.
3. How to Stop SSHD Service on OpenSUSE Linux
To Stop sshd service on OpenSUSE Linux you need to use
systemctl stop sshd command as shown below. Alternatively you can also use
service sshd stop command to stop the sshd service.
4. How to Check Status of SSHD Service on OpenSUSE Linux
To check the status of sshd service on OpenSUSE Linux you need to use
systemctl status sshd command as shown below. Alternatively you can also use
service sshd status command to check the sshd service status.
If you see any error during sshd service restart then you need to open and check your ssh configuration file using your favourite editor as shown below. SSH Configuration file can usually be found in
/etc/ssh/sshd_config file. You can check more about sshd config on SSH Man Page.
localhost:~ # vi /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value. Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: #HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_ecdsa_key #HostKey /etc/ssh/ssh_host_ed25519_key # Ciphers and keying #RekeyLimit default none # Logging #SyslogFacility AUTH #LogLevel INFO # Authentication: #LoginGraceTime 2m PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10
To check sshd process if it is running or not you can use
pgrep sshd command as shown below.
localhost:~ # pgrep sshd 1246 6554
Alternatively, you can also check the sshd process by using
ps -ef | grep -i sshd | grep -v grep command as shown below.
localhost:~ # ps -ef | grep -i sshd | grep -v grep root 1246 1 0 Dec17 ? 00:00:00 /usr/sbin/sshd -D root 6554 1246 0 09:52 ? 00:00:00 sshd: root@pts/1
If you want to check all the options set in the
sshd_config file then you can invoke
sshd command with
-T option and check that as shown below. This option is used to test the sshd configuration.
localhost:~ # sshd -T port 22 addressfamily any listenaddress [::]:22 listenaddress 0.0.0.0:22 usepam yes logingracetime 120 x11displayoffset 10 maxauthtries 6 maxsessions 10 clientaliveinterval 0 clientalivecountmax 3 streamlocalbindmask 0177 permitrootlogin yes ignorerhosts yes ignoreuserknownhosts no hostbasedauthentication no hostbasedusesnamefrompacketonly no