2011年6月17日 星期五

Linux-SSH

透過ssh遠端控制主機



#install ssh
sudo apt-get install openssh-server(本端需有opsessh-client)

#set sshd_config
sudo vim /etc/ssh/sshd_config
>Port xx(default is 22)
>PermitRootLogin no

#set hosts allow&deny
sudo vim /etc/hosts.allow
>sshd:ip1 ip2...

sudo vim /etc/hosts.deny
>sshd:ALL (but addmit ip  of allow

#restart
sudo /etc/init.d/ssh restart

#login
ssh -p port user@ip

(如使用預設port22,可省略-p user@ip則是使用遠端主機帳號和ip登入 如不打帳號直接用ip則會使用目前本端帳號登入)

#log out ssh
exit

沒有留言:

張貼留言