Ubuntu配置SSH

1.安装SSH

sudo apt-get install openssh-server

Ubuntu配置SSH

2.启动服务

sudo /etc/init.d/ssh start

Ubuntu配置SSH

3. 查看是否正确启动

ps -e | grep ssh

Ubuntu配置SSH

4. 生成公钥和私钥

ssh-keygen -t rsa

Ubuntu配置SSH

5. 查看公钥和私钥

Ubuntu配置SSH

6.将自己的公钥追加到authorized_keys中

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Ubuntu配置SSH

7.登录SSH(这里就不再需要输入密码了)

ssh localhost

Ubuntu配置SSH
 
8.退出exit

Ubuntu配置SSH