Linux ssh connection

1. 确定可以ping通linux服务器
 
2. 确定可以telnet通linux服务器22端口;
local check port status: netstat -antup
如果不同,或者修改防火墙规则;或者选择关闭防火墙。/etc/init.d/iptables stop
 
3. 修改ssh配置文件/etc/ssh/sshd_config
a. 原文:#PermitRootLogin yes
修改成:PermitRootLogin yes
b. 原文:UseDNS yes
修改成:UseDNS no
修改完成后重启sshd服务:service sshd restart
 
Additional:
If the port is not the default port,
ssh <IP address> -p <port>

SSH hang after authoration successful 
reason: manually error remove the # for the "ForceCommand cvs server" Line

Prevent user login by ssh
Mehod 1
1. add /etc/ssh/sshd_config file with following context
Denyusers <user name>
2. Restart the ssh service
service sshd restart

Method 2
1. Create user with command: useradd -s /sbin/nologin <new username>
2. change user with usermod -s /sbin/nologin <username >

Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error