1.为了避免ROOT用户直接访问服务器,新建一个用户来连接ssh
创建用户
adduser joe (joe为新建用户名)
设置密码
passwd joe (键入joe的口令)
修改ROOT密码
passwd root (输入root新密码)
2.修改ssh端口
/etc/ssh/sshd_config //编辑ssh配置文件
[root@linux ~]# vi /etc/ssh/sshd_config# $OpenBSD: sshd_config,v 1.69 2004/05/23 23:59:53 dtucker Exp $ # This is the sshd server system-wide configuration file. See# sshd_config(5) for more information.# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with# OpenSSH is to specify options with their default value where# possible, but leave them commented. Uncommented options change a# default value.Port 8284 //以前这个前面是有 # 号的,而且默认是 22 ,修改一下就ok了#Protocol 2,1#ListenAddress 0.0.0.0#ListenAddress ::# HostKey for protocol version 1#HostKey /etc/ssh/ssh_host_key# HostKeys for protocol version 2#HostKey /etc/ssh/ssh_host_rsa_key#HostKey /etc/ssh/ssh_host_dsa_key........#LoginGraceTime 2mPermitRootLogin no //设置 no 禁止ROOT用户直接访问#StrictModes yes#MaxAuthTries 6#MaxSessions 10
保存,重起ssh服务,修改端口才生效
[root@linux ~]# /etc/init.d/sshd restartStopping sshd: [ OK ]Starting sshd: [ OK ][root@linux ~]#
以上为基本操作设置
更详细请参考:http://blog.chinaunix.net/uid-25472509-id-3011773.html