我正在尝试启用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.
Run Code Online (Sandbox Code Playgroud)
正在侦听端口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
Run Code Online (Sandbox Code Playgroud)
但我无法连接到它.
[root@lep8a peeyush]# ssh root@192.168.122.19
ssh: connect to host 192.168.122.19 port 22: Connection timed out
Run Code Online (Sandbox Code Playgroud)
我的头脑在寻找互联网上的解决方案.什么都行不通.你能帮帮我吗?
小智 17
检查防火墙是否接受端口22上的传入TCP连接:
# iptables -nL | grep 22
Run Code Online (Sandbox Code Playgroud)
如果结果为空,则必须在防火墙中添加规则.
打开Yast和防火墙配置:
# yast firewall
Run Code Online (Sandbox Code Playgroud)
转到"允许的服务"并添加"安全Shell服务器".保存并退出Yast并尝试连接.
注释:如果您完全禁用了防火墙(不推荐),则此答案不适用.
小智 7
运行此命令:
systemctl enable sshd.service
Run Code Online (Sandbox Code Playgroud)
然后在您的/etc/ssh/sshd_config文件中进行必要的更改,并从以下开始sshd:
systemctl start sshd.service
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
40444 次 |
| 最近记录: |