标签:private linux public 用户 enter
普通用户(xusj)进行免秘钥登陆步骤如下:
在主机A 192.168.1.1上操作
ssh-keygen -t rsa //参数公钥和私钥对,输入后一路回车。
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xusj/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in/home/xusj/.ssh/id_rsa.
Your public key has been saved in /home/xusj/.ssh/id_rsa.pub.
将主机A的公钥拷贝至主机B的普通用户对应目录
ssh-copy-id -i ~/.ssh/id_rsa.pub xusj@192.168.1.2
然后输入主机B的xusj用户密码,此时主机B已经有主机A的公钥,因此此时主机A访问B已经不需要密码,可以直接登录
在主机A直接登录主机B,此时已经不需要输入秘钥:
ssh 192.168.1.2
Last login: Sat Nov 21 00:28:04 2015 from 192.168.1.1lightspeed.hstntx.sbcglobal.net
本文出自 “少犟” 博客,请务必保留此出处http://xushaojie.blog.51cto.com/6205370/1715302
标签:private linux public 用户 enter
原文地址:http://xushaojie.blog.51cto.com/6205370/1715302