키 ssh
에 존재하고 로드되었을 수 있는 SSH 키 쌍을 일시적으로 무시하려면 어떻게 해야 합니까 ?$HOME/.ssh
ssh-agent
노트:$HOME/.ssh
SSH 키 쌍 파일을 디렉토리 외부로 이동하여 디렉토리를 변경하고 싶지 않으며 , $HOME/.ssh/config
파일을 편집하고 싶지도 않고, 키링(예: )에서 키를 삭제하고 싶지도 않습니다 ssh-agent
.
답변1
제가 보통 하는 일은 다음과 같습니다.
$ ssh -o IdentitiesOnly=yes -F /dev/null -i ~/path/to/some_id_rsa [email protected]
옵션은 다음과 같습니다:
-o IdentitiesOnly=yes
$HOME/.ssh
- ssh-agent에서 또는 ssh-agent를 통해 제공된 키 가 아닌 CLI를 통해 제공된 키만 사용하도록 SSH에 지시합니다.-F /dev/null
- 사용금지$HOME/.ssh/config
-i ~/path/to/some_id_rsa
- 연결에 명시적으로 사용하려는 키
예
$ ssh -v -o IdentitiesOnly=yes -F /dev/null -i ~/my_id_rsa [email protected]
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /dev/null
debug1: Connecting to someserver.mydom.com [10.128.12.124] port 22.
debug1: Connection established.
debug1: identity file /Users/sammingolelli/my_id_rsa type 1
debug1: identity file /Users/sammingolelli/my_id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA f5:60:30:71:8c:a3:da:a3:fe:b1:6d:0b:20:87:23:e1
debug1: Host 'qa03-ost-tesla-h-app01' is known and matches the RSA host key.
debug1: Found key in /Users/sammingolelli/.ssh/known_hosts:103
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/sammingolelli/my_id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to someserver.mydom.com ([10.128.12.124]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
Last login: Tue Dec 8 19:03:24 2015 from 153.65.219.15
someserver$
위 출력에서는 ssh
개인 키만 CLI를 통해 식별되고 my_id_rsa
서버에 연결하는 데 사용됩니다.