codedeploy 运行挂钩脚本的默认用户是什么?

What is the default user that codedeploy runs the hook scripts as?

背景:我遇到这个错误

在 afterInstall 步骤中,我试图从 afterInstall.sh 文件 运行 一个 php 文件,但出现此错误 - 无法打开 php 文件.

我不确定具体要做什么。想尝试手动检查我是否可以 运行 作为该用户的文件。

  • 运行作为 AppSpec 文件中的可选字段。 运行ning 脚本时要模拟的用户。默认情况下,这是实例上的 AWS CodeDeploy 代理 运行ning(如果您不指定非根用户,它将是根用户)。

  • 到运行主机代理作为非root用户,需要设置环境变量CODEDEPLOY_USER,作为link到主机代理源代码显示。环境变量可以设置为您希望主机代理 运行 作为的任何用户。

CodeDeploy 代理默认用户是 root

下面的目录列表显示了部署成功后目标文件夹 /tmp 中已部署文件的所有权。

ubuntu@ip-10-0-xx-xx:~$ ls -l /tmp
total 36
-rw-r--r-- 1 root root    85 Aug  2 05:04 afterInstall.php
-rw-r--r-- 1 root root    78 Aug  2 05:04 afterInstall.sh
-rw-r--r-- 1 root root  1397 Aug  2 05:04 appspec.yml
-rw------- 1 root root  3189 Aug  2 05:07 codedeploy-agent.update.log
drwx------ 2 root root 16384 Aug  2 03:01 lost+found
-rw-r--r-- 1 root root    63 Aug  2 05:04 out.log