Linux 添加ssh 公钥访问
登陆被管理的服务器,进入需要远程登陆的用户目录,把公钥放到用户目录的 .ssh 这个目录下(如果目录不存在,需要创建~/.ssh目录,并把目录权限设置为700),把公钥改名为authorized_keys2,并且把它的用户权限设成600。 [peter@client ~]$ ls id_rsa.pub [peter@client ~]$ mkdir ~/.ssh #如果当前用户目录下没有 .ssh 目录,请先创建目录 [peter@client ~]$ chmod 700 ~/.ssh [peter@client ~]$ mv id_rsa.pub ~/.ssh [peter@client ~]$ cd ~/.ssh [peter@client ~]$ cat id_rsa.pub >> authorized_keys2 [peter@client ~]$ rm -f id_rsa.pub [peter@client ~]$ chmod 600 authorized_keys2 [peter@client ~]$ ls -l total 4 -rw------- 1 peter peter 225 Oct 10 11:28 authorized_keys2 测试使用密钥对进行远程登陆 [root@server ~]# ssh [email protected] Enter passphrase for key '/root/.ssh/id_rsa': #提示输入密码短语,请输入刚才设置的密码短语 Last login: Sun Oct 10 11:32:14 2010 from 192.168.0.1 [peter@client ~]$
相关推荐
airfish000 2020-09-11
风语者 2020-09-02
lichuanlong00 2020-08-15
projava 2020-11-14
WanKaShing 2020-11-12
tryfind 2020-09-14
yegen00 2020-09-10
kkaazz 2020-09-03
BraveWangDev 2020-08-19
gsl 2020-08-15
pandaphinex 2020-08-09
yhuihon 2020-08-09
CheNorton 2020-08-02
xiangqiao 2020-07-28
hpujsj 2020-07-26
hpujsj 2020-07-26
sshong 2020-07-19
BraveWangDev 2020-07-19
annan 2020-07-18