Solutions to the problem of SSH not connecting (must see)


Problem: you can ping the Linux server, but SSH can’t connect < Linux RedHat AS4 version >

It took me 20 minutes to find out the solution. There are various solutions written on the Internet. However, they were finally solved and shared to learn with you.

The server is normal, and Ping can also connect. But SSH can’t be connected. The biggest possibility of this problem is that the firewall is not closed.


1、 Enable SSH

Log in to Linux as root, open the terminal, and run / etc / init.d/sshd reset

2、 Turn off firewall

1. Run setup on the terminal

2. Select firewall enter

3. Press tab to switch to the disabled item, then press the space bar to select, then press tab to switch to OK, and then press the space bar to select

4. Press tab to switch to quit and press blank to select

Then log in to Linux with client SSH, and log in successfully, ha ha^_^

3、 Another way to turn off the firewall

/etc/init.d/iptables stop

Add one, some versions of red flag Linux do not allow root users to log in remotely. You need to modify the settings ා VI / etc / SSH / sshd_ Config

PermitRootLogin no

#This does not allow the root user to log in remotely. Only modify it to permitrootlogin yes and restart the sshd service.

#service sshd restart

4、 A detailed example of the first question

Just installed a RedHat As5 on the virtual machine, and SSH from the local fc9 to log in. The connection failed.

ssh: connect to host port 22: Connection refused
lost connection

I thought it was the problem of firewall and SELinux on the virtual machine. After closing both of them, there was still a problem in logging in. Later, I thought about whether there was an sshd process running, which was not surprising.

#ps -ef|grep ssh
root  2774 2613 0 Dec09 ?    00:00:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "gnome-session"
root 15899 11276 0 11:47 pts/1  00:00:00 grep ssh

It is found that only SSH agent process is running, ssh server process sshd is not running at all, fainting, how to install the system just now, how to disable the sshd service. Ha ha, the specific problems need to be further studied.

Start sshd process

#services sshd start
Starting sshd:                       [ OK ]

Log in again ok.

The above solution to the problem of SSH disconnection (you must see) is all the content shared by Xiaobian. I hope it can give you a reference, and I hope you can support developepaer more.