歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> SSH 連接問題 SSh Agent admitted failure to sign using the key

SSH 連接問題 SSh Agent admitted failure to sign using the key

日期:2017/2/28 16:03:43   编辑:Linux教程

現有2台機器

1、服務器192.168.1.112

2、個人機192.168.1.110

要使110無需密碼通過ssh登入112

步驟

1、創建密鑰

  1. miao@u32-192-168-1-110:~/.ssh$ ssh-keygen -t rsa
  2. Generating public/private rsa key pair.
  3. Enter passphrase (empty for no passphrase): (忽略)
  4. Enter same passphrase again: (忽略)
  5. Your identification has been saved in /home/miao/.ssh/id_rsa.
  6. Your public key has been saved in /home/miao/.ssh/id_rsa.pub.

2、復制公密到www.linuxidc.com服務器

  1. miao@u32-192-168-1-110:~/.ssh$ scp id_rsa.pub [email protected]:/home/miao/.ssh/192.168.1.110
  2. [email protected]'s password:
  3. id_rsa.pub 100% 404 0.4KB/s 00:00
  4. miao@u32-192-168-1-110:~/.ssh$

3、添加公密到192.168.112的信任區域

view plain
  1. miao@debian-192-168-1-112:~/.ssh$ cat 192.168.1.110 >> authorized_keys
  2. miao@debian-192-168-1-112:~/.ssh$

注: 2,3兩步可由命令ssh-copy-id一步到位
view plain
  1. miao@Ubuntu-192-168-1-110:~/.ssh$ ssh-copy-id [email protected]
  2. Password:
  3. Now try logging into the machine, with "ssh '[email protected]'", and check in:
  4. .ssh/authorized_keys
  5. to make sure we haven't added extra keys that you weren't expecting.

4、啟動ssh-agent

如果ssh 192.168.112返回 Agent admitted failure to sign using the key
ps -Af|grep agent查看有無ssh-agent有無運行,
miao@u32-192-168-1-110:~/.ssh$ ps -Af|grep agent 5、若沒有 添加id_rsa到ssh-agent miao@u32-192-168-1-110:~/.ssh$ ssh-agent
Copyright © Linux教程網 All Rights Reserved