How to enable SSH on SLES 12?
Asked Answered
D

3

5

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?

Devon answered 19/3, 2015 at 17:1 Comment(1)
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask. Also see Where do I post questions about Dev Ops?.Proficiency
I
18

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.

Impetuosity answered 4/6, 2015 at 11:44 Comment(1)
Does yast do anything besides change the iptables rules with that command?Vidovik
P
7

Run this command:

systemctl enable sshd.service

Then make necessary changes in your /etc/ssh/sshd_config file, and start sshd via:

systemctl start sshd.service
Purcell answered 8/9, 2015 at 6:31 Comment(2)
sshd.service is already enabled as per the output in question. You should have provided info on "necessary" changes in the config file...Complected
Other people find this answer by googling and this answer helps them.Alfredoalfresco
O
1

I was dealing with the same problem in SUSE Linux Enterprise Server 15 x86-64. Within the system I was able to # ssh 127.0.0.1 (so the sshd service was working correctly), but from other nodes I got a "Timed out" message.

First, I checked the firewall rules (see answer from xloto):

# iptables -nL | grep 22

Resulted in an empty return message, so we need to set an additional rule.

To set the the firewall rule for SSH's standard port 22, I followed another tutorial (as I do not have a GUI):

# firewall-cmd --permanent --add-service=ssh
# firewall-cmd --reload

It worked for my case, but I'm not sure whether this is best practice.

Ostrich answered 5/10, 2018 at 11:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.