让FreeBSD的root用户能够SSH登陆

原文:http://www.cppblog.com/tx7do/archive/2010/06/24/118614.html

如果刚装好FreeBSD,默认是不允许root用户登录SSH的,如果登陆结果就会如下:

用PuTTY登陆时,总提示:
login  as: root
Using keyboard-interactive authentication.
Password:
Access denied



这个时候需要编辑其配置文件,输入以下命令进行修改:

ee /etc/ssh/sshd_config

然后进行修改.


找到

#PasswordAuthentication no

修改为:

PasswordAuthentication yes

这段的意思是,让SSH使用密码验证登陆.

找到

#PermitRootLogin no

修改为

PermitRootLogin yes

这段的意思是,让SSH准许root用户登录.一般来说,为了安全起见,这一段还是不要允许的好.不过安全要求不高,可以这样做.

找到

#PermitEmptyPasswords no

修改为

PermitEmptyPasswords no

这段的意思是,使得允许空密码成为不可用,换句话说就是,不允许空密码登陆.

检查是否在/etc/inetd.conf 中打开了,请把它注释掉:

ssh     stream  tcp     nowait  root    /usr/sbin/sshd          sshd -i -4

改成

#ssh     stream  tcp     nowait  root    /usr/sbin/sshd          sshd -i -4

保存、重启

/etc/inetd restart



这样就root用户就可以用SSH客户端远程登陆FreeBSD了.

需要注意的是,在/etc/ssh下面有两个配置文件:/etc/ssh/sshd_config和/etc/ssh/ssh_config,我们需要修改的是/etc/ssh/sshd_config,我最开始就弄错了--!修改到了/etc/ssh/ssh_config去了,结果咋都不对,寒.

猜你喜欢

转载自aigo.iteye.com/blog/2037196