Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello.
When you want SSH to a new server for the first time, SSH show you a key that must be adding to "known_hosts" file but if I want to remove a specific SSH key server then how can I find it?
For example, When I SSH to a server an output like below shown :
Code:
OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to Server [IP] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/jason/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com zlib@openssh.com
debug1: kex: client->server aes128-ctr umac-64@openssh.com zlib@openssh.com
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<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 9a:91:c9:92:05:5d:df:8d:47:b7:fc:4c:17:51:64:1d
debug1: Host 'usa-1.createssh.com' is known and matches the RSA host key.
debug1: Found key in /home/jason/.ssh/known_hosts:33
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available
debug1: Next authentication method: publickey
debug1: Trying private key: /home/jason/.ssh/id_rsa
debug1: Trying private key: /home/jason/.ssh/id_dsa
debug1: Trying private key: /home/jason/.ssh/id_ecdsa
debug1: Trying private key: /home/jason/.ssh/id_ed25519
debug1: Next authentication method: password
jason@Server's password:
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (password).
I know the is in line 33 as output said but when I grep "RSA 9a:91:c9:92:05:5d:df:8d:47:b7:fc:4c:17:51:64:1d" then I can't find anything!!!
Hello.
When you want SSH to a new server for the first time, SSH show you a key that must be adding to "known_hosts" file but if I want to remove a specific SSH key server then how can I find it?
You'll have to hunt for it by host name or ip number and remove the line from known_hosts. If you don't want to dig through known_hosts with an editor, you can have ssh-keygen remove the key for you:
Code:
ssh-keygen -R 198.51.100.13 -f ~/.ssh/known_hosts
That will remove the key and save a backup copy of it in known_hosts.old. That method works even for lists where the host name or ip number is hashed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.