How to display the mac address of known host by ssh

0

I want to know the MAC address of a machine that I don't have access to at the moment. However, I have a known_hosts file from ssh with a valid entry, and given that I get warnings about changing MAC addresses I presume that this address is stored somewhere by ssh. Is there a way to display this saved MAC address?

user1978011

Posted 2015-06-11T20:04:05.423

Reputation: 103

Note that unless the SSH server is directly on your LAN (no routers between you and it), you will never know the mac address of the server. Since SSH is laregly made for remote access, its unlikely that the service knows or cares about any given MAC address at all, and certianly wouldn't bother to record it, especially as a load balanced server might have multiple legitimate MACs. What SSH does record in known_hosts is the key fingerprint that the service uses to identify itself. – Frank Thomas – 2015-06-11T20:12:55.893

Answers

3

I think you're mistaking it for a fingerprint. The SSH Fingerprint is supposed to be unique to each installation, and that key gets saved when you connect to a remote system. See this question and its answers for more information.

If you know the IP address, and it's on your network, you can ping the server, then run an arp -a | grep <IPA.ddr.e.ss> (without the <> signs), and get the MAC address that way.

Canadian Luke

Posted 2015-06-11T20:04:05.423

Reputation: 22 162

Good point on the fingerprint! :) – ChrisInEdmonton – 2015-06-11T20:14:00.753

I'd really like to know why it got down voted – Canadian Luke – 2015-06-11T23:13:42.597

Strange. There's useful information there that isn't in my answer. You got my +1. – ChrisInEdmonton – 2015-06-11T23:25:18.790

5

The MAC address is not stored in the known_hosts file. Take a look at the sshd man page.

 Each line in these files contains the following fields: markers
 (optional), hostnames, bits, exponent, modulus, comment.  The fields are
 separated by spaces.

ChrisInEdmonton

Posted 2015-06-11T20:04:05.423

Reputation: 8 110