If AWS Sessions Manager executes a file in EC2, which user in the executed EC2 executes the file?

30 views Asked by At

When I execute a sh file in EC2 using AWS Sessions Manager's Run Command, does the user (root or other user I created) configured in the executed EC2 execute the sh? Also, how do I know which user executed it?

1

There are 1 answers

0
Marcin On

It runs as root. You can simply check it by running the following command in Run Command:

whoami > /tmp/info

Then login to the instance and check /tmp/info. You can do same for working directory pwd >> /tmp/info or any parameter you want to check.