如果剛裝好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去了,結果咋都不對,寒.