Reputation: 107
Is there any way to know which particular machine connected to an EC2(ubuntu 12.04) instance during a specific time?
For example, I want to know which public key(ssh key) was used to connect to my EC2 instance during a specific time?
Is there any feature in AWS to get that information or can I enable some extra logging in ubuntu to know that?
P.S. The "last" command does not help me as it shows the IP address which connected to the EC2 machine and in my case it shows the IP address of my company not the machine's
Upvotes: 1
Views: 622
Reputation: 2073
You can look into log file: /var/log/auth.log, login information look like this:
Mar 30 11:09:19 void sshd[1895]: Accepted publickey for vagrant from 10.0.2.2 port 63936 ssh2
Mar 30 11:09:19 void sshd[1895]: pam_unix(sshd:session): session opened for user vagrant by (uid=0)
As you can see time, user login, ip and authentication method data is logged by default.
Upvotes: 1