SSH client

Install:

sudo apt-get install ssh
# or sudo apt-get install openssh-client
ssh-keygen
#out>>id_rsa id_rsa.pub 私钥和公钥

Usage:

ssh -p 22 root@192.168.8.200
#>enter password
logout
#or exit

SSH server

Install:

sudo apt-get install openssh-server
ps -e|grep ssh # 确认是否启动sshd
sudo/etc/init.d/ssh start #通过启动项启动
#ifconfig 查看本机地址

Manage:

sudo /etc/init.d/ssh stop    #停止
sudo /etc/init.d/ssh start   #启动
sudo /etc/init.d/ssh restart #重启

Config:

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak #备份
vim /etc/ssh/sshd_config
#重要配置
#改默认端口反扫
#Port 22
#禁止root登陆
#PermitRootLogin yes
#拖慢登陆速度的反查客户端dns
#GSSAPIAuthentication yes
#GSSAPIDelegateCredentials no 
#开启证书认证登陆
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys 使用ssh-keygen生成的公钥