ubuntu14.04配置ssh登陆

搞了之后死活连不上去。

只好继续使用22的端口,禁用root登陆。突然就好了。

几个命令:

重启 /etc/init.d/ssh restart

看是否在 ps -e | grep ssh

服务器的配置文件 /etc/init.d/sshd_config

至于说:

ssh-keygen-t rsa 这个是不是有作用,我还不知道啊。

=================================
1.安裝 OpenSSH Server

sudo aptitude install openssh-server

sudo apt-get install openssh-server

2.取消 root 的登入權限

這是基於安全的考量, 一般都不會設定讓 root 可以連進來, 不然,駭客就會很方便的哩 ! 首先,打開在 /etc/ssh/sshd_config 的 SSH 設定檔,然後,找到下面這一行,把它的 yes 改成 no 之後,就把它存檔起來。

#PermitRootLogin Yes

或是

PermitRootLogin No

3.設定可以連線的主機

打開 /etc/hosts.allow 檔,把允許的主機 IP 加進來, 以阿舍想要讓 192.168.1.88 這台機器可以連進來為例,就輸入下面這樣的一行,然後就存檔起來。

sshd:192.168.1.88:allow

再來, 再打開 /etc/hosts.deny 檔,把下面這一行給加進去,這樣其它的主機都會被設為拒絕連線,所以,這台主機就只有上面設定的 192.168.1.88 那一台可以連進來了哩。

sshd:all:deny

4.重啟 SSH Server

用下面的指令來重啟 SSH Server 之後,就算安裝設定完成了哩 !

sudo /etc/init.d/ssh restart

另外,如果要使用更安全的以憑證來連線 SSH ,就請參考這裡。
Read more: http://www.arthurtoday.com/2010/08/ubuntu-ssh.html#ixzz3wWti3wO6

猜你喜欢

转载自blog.csdn.net/commshare/article/details/76165127