How to enable SSH on SLES 12?

Pensu picture Pensu · Mar 19, 2015 · Viewed 44.2k times · Source

I am trying to enable ssh connection to suse linux. I have sshd service running:

peeyush@linux-pohb:~/gccgo.work> systemctl status sshd.service
sshd.service - OpenSSH Daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: active (running) since Thu 2015-03-19 18:36:05 IST; 3h 50min ago
  Process: 5702 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUCCESS)
 Main PID: 6035 (sshd)
   CGroup: /system.slice/sshd.service
           └─6035 /usr/sbin/sshd -D

Mar 19 18:36:01 linux-pohb sshd-gen-keys-start[5702]: Checking for missing se...
Mar 19 18:36:05 linux-pohb sshd-gen-keys-start[5702]: ssh-keygen: generating ...
Mar 19 18:36:06 linux-pohb sshd[6035]: Server listening on 0.0.0.0 port 22.
Mar 19 18:36:06 linux-pohb sshd[6035]: Server listening on :: port 22.
Hint: Some lines were ellipsized, use -l to show in full.

It is listening on port 22 fine:

peeyush@linux-pohb:~/gccgo.work> netstat -an | grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      
tcp        0      0 :::22                   :::*                    LISTEN 

But I am not able to connect to it.

[root@lep8a peeyush]# ssh [email protected]
ssh: connect to host 192.168.122.19 port 22: Connection timed out

My head is aching with finding solutions on internet. Nothing is working. Could you guys please help me out?

Answer

xloto picture xloto · Jun 4, 2015

Check if your firewall accepts incoming TCP connections on port 22:

# iptables -nL | grep 22

If the result is empty, you have to add a rule in your firewall.

Open Yast and firewall configuration:

# yast firewall

Goto "Allowed Services" and add "Secure Shell Server". Save and quit Yast and try to connect.

Comment: If you have disabled your firewall completly (not recommended) this answer does not apply.