如果剛裝好FreeBSD,默認(rèn)是不允許root用戶登錄SSH的,如果登陸結(jié)果就會(huì)如下:
用PuTTY登陸時(shí),總提示:
login as: root
Using keyboard-interactive authentication.
Password:
Access denied
這個(gè)時(shí)候需要編輯其配置文件,輸入以下命令進(jìn)行修改:
ee /etc/ssh/sshd_config
然后進(jìn)行修改.
找到
#PasswordAuthentication no
修改為:
PasswordAuthentication yes
這段的意思是,讓SSH使用密碼驗(yàn)證登陸.
找到
#PermitRootLogin no
修改為
PermitRootLogin yes
這段的意思是,讓SSH準(zhǔn)許root用戶登錄.一般來說,為了安全起見,這一段還是不要允許的好.不過安全要求不高,可以這樣做.
找到
#PermitEmptyPasswords no
修改為
PermitEmptyPasswords no
這段的意思是,使得允許空密碼成為不可用,換句話說就是,不允許空密碼登陸.
檢查是否在/etc/inetd.conf 中打開了,請(qǐng)把它注釋掉:

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客戶端遠(yuǎn)程登陸FreeBSD了.
需要注意的是,在/etc/ssh下面有兩個(gè)配置文件:/etc/ssh/sshd_config和/etc/ssh/ssh_config,我們需要修改的是/etc/ssh/sshd_config,我最開始就弄錯(cuò)了--!修改到了/etc/ssh/ssh_config去了,結(jié)果咋都不對(duì),寒.