Linux SSH 鏈接不上

http://blog.csdn.net/cryhelyxx/article/details/46473783shell

在xshell下用ssh登陸遠程主機centos出現如下問題:vim

Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Connection closed by foreign host.

Type `help' to learn how to use Xshell prompt.
Xshell:\>

以前用xshell遠程登陸centos都是能夠的, 就在我重裝了openssh-server後出現這問題, 因而我猜這多是ssh配置文件/etc/ssh/sshd.conf的問題centos

2. 解決方法

編輯ssh配置文件/etc/ssh/sshd.conf:ssh

# vim /etc/ssh/sshd.conf

找到下面的X11Forwarding yes, 將其改成no或在前面加#註釋便可。.net

X11Forwarding設置是否容許X11轉發rest

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none

重啓ssh服務:code

# service sshd restart
相關文章
相關標籤/搜索