Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用 AWS Sessions Manager 的运行命令在 EC2 中执行 sh 文件时,在执行的 EC2 中配置的用户(root 或我创建的其他用户)是否执行 sh?另外,我怎么知道哪个用户执行了它?
它以root身份运行。您可以通过在 Run Command 中运行以下命令来简单地检查它:
whoami > /tmp/info
然后登录到实例并检查/tmp/info. 您可以对工作目录pwd >> /tmp/info或要检查的任何参数执行相同操作。
/tmp/info
pwd >> /tmp/info