Score:0

Can we find IP that logged into linux EC2 and ran particular command?

ve flag

We have a linux ec2 instance.

One of us logged into our ec2 and ran a command, say python --version.

I know the date and time they have run this command.

Now, Is there a way I can find the IP from which they logged into our ec2 and run this command?

P.S. We switch to particular user to run commands, specifically for that directory.

anx avatar
fr flag
anx
Without proper auditing logs, you may not even be able to tell if it was one the users of the shared (eww..) account, or if there the user was *logged in* at the time the command ran.
Tim avatar
gp flag
Tim
No, you can't do that.
Jack avatar
ve flag
Hello @anx, We use the same user to run all commands. By this, I meant, only that user has access to run commands, in a specific directory. It's not the user we use to login. And, I do have administrator access and complete console access, if these help me find IP?
Score:1
id flag
MLu

If you configure something like Snoopy beforehand then you may be able to correlate the IP with the TTY and with the command.

But note that it must be done before the activity and it can relatively easily be inhibited if someone is keen to hide their actions.


However you may still be lucky - check the output of last command to see who was logged in and from where. If there was only one user logged in at the time the command was run that's possibly your user/IP.

Jack avatar
ve flag
Thank you, last command helped.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.