ssh - 如何在 SLES 12 上启用 SSH?

标签 ssh opensuse sles

我正在尝试启用 ssh 连接到 suse linux。我正在运行 sshd 服务:

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.

它正在端口 22 上正常监听:

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 

但我无法连接到它。

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

在互联网上寻找解决方案让我头疼。什么都不起作用。 你们能帮我一下吗?

最佳答案

检查您的防火墙是否接受端口 22 上的传入 TCP 连接:

# iptables -nL | grep 22

如果结果为空,则您必须在防火墙中添加规则。

打开 Yast 和防火墙配置:

# yast firewall

转到“允许的服务”并添加“Secure Shell 服务器”。保存并退出 Yast 并尝试连接。

评论:如果您完全禁用防火墙(不推荐),则此答案不适用。

关于ssh - 如何在 SLES 12 上启用 SSH?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29150690/

相关文章:

linux - sed 不能在远程机器上工作

docker:来自守护进程的错误响应:grpc:连接不可用

linux - grpc++ 中的 SSL 握手错误(CERTIFICATE_VERIFY_FAILED)

linux - SLES 12 : Client service neither service nor target?

用于设置临时 SSH 隧道的 Bash 脚本

php - 使用 PHP SSH 连接到远程服务器

linux - 多个 ssh 命令中的 cat 不起作用

bash - OpenSuse Linux 上的 .bashrc 或 .bash_profile 在哪里?

linux - 为什么 'mv' 命令在将文件向上移动多个级别时不起作用

linux - 获取 systemd 的默认限制