ssh无密登陆localhost
来源:互联网 发布:特别纳税调整 知乎 编辑:程序博客网 时间:2024/05/23 12:02
1、安装ssh
sudo apt-get ssh install
2、生成密钥
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
3、将公钥放入认证文件
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
4、修改文件权限
sudo chmod 700 ~/.ssh
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub
sudo chmod 644 ~/.ssh/authorized_keys
显示如下:
drwxr-xr-x 2 will will 4096 May 31 22:42 .
drwxr-xr-x 31 will will 4096 May 31 22:22 ..
-rw------- 1 will will 393 May 31 22:42 authorized_keys
-rw------- 1 will will 1679 May 31 22:42 id_rsa
-rw------- 1 will will 393 May 31 22:42 id_rsa.pub
-rw-r--r-- 1 will will 666 May 31 08:41 known_hosts
此处假设.ssh的父目录是xxx .ssh的路径 /home/xxx/.ssh
sudo chmod 755 /home/xxx (我就是因为没有设置该文件夹的权限弄了很久都没成功!)
5、测试
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com/
361 packages can be updated.
208 updates are security updates.
New release '16.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Wed May 31 22:59:20 2017 from localhost
xxx@ubuntu:~$ exit
logout
Connection to localhost closed.
sudo apt-get ssh install
2、生成密钥
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
3、将公钥放入认证文件
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
4、修改文件权限
sudo chmod 700 ~/.ssh
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub
sudo chmod 644 ~/.ssh/authorized_keys
显示如下:
drwxr-xr-x 2 will will 4096 May 31 22:42 .
drwxr-xr-x 31 will will 4096 May 31 22:22 ..
-rw------- 1 will will 393 May 31 22:42 authorized_keys
-rw------- 1 will will 1679 May 31 22:42 id_rsa
-rw------- 1 will will 393 May 31 22:42 id_rsa.pub
-rw-r--r-- 1 will will 666 May 31 08:41 known_hosts
此处假设.ssh的父目录是xxx .ssh的路径 /home/xxx/.ssh
sudo chmod 755 /home/xxx (我就是因为没有设置该文件夹的权限弄了很久都没成功!)
5、测试
ssh localhost
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com/
361 packages can be updated.
208 updates are security updates.
New release '16.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Wed May 31 22:59:20 2017 from localhost
xxx@ubuntu:~$ exit
logout
Connection to localhost closed.
阅读全文
1 0
- ssh无密登陆localhost
- ssh无密码登陆localhost
- ssh localhost, ssh免密码登陆localhost
- ssh localhost 免密码登陆
- 最简单的ssh无密登陆
- ssh无密码登陆
- ssh 无密码登陆
- ssh无密码登陆
- ssh 无密码登陆
- ssh无密码登陆
- ssh 无密码登陆
- SSH 无密码登陆
- ssh无密钥登陆
- ssh无密码登陆
- SSH 无密码登陆
- SSH无密钥登陆
- ssh无密码登陆
- SSH无密码登陆
- jQuery Mobile 工具栏
- EA&UML日拱一卒--序列图(Sequence Diagram)::状态不变量
- 线程的五大状态
- Android走马灯滚动效果的实现
- github之保存当前状态git stash
- ssh无密登陆localhost
- 逻辑和判断谁是小偷
- 大数据之大数阶乘
- 博弈论之巴什博弈
- struts2+AJAX实现无刷新进行验证
- 如何根据RGB值生成UIImage,暂时用不到这些,记录一下。
- PB 执行存储过程
- activeMQ实例在项目中的运用二【项目实战系列】
- 查出的表格数据,每一行的特殊处理