gpt4 book ai didi

node.js - 尽管以 root 身份运行所有内容,为什么 aws 代码部署会抛出 "No passwd entry for user ' ec2-user'"错误?

转载 作者:太空宇宙 更新时间:2023-11-04 02:09:47 25 4
gpt4 key购买 nike

以下是错误消息:

enter image description here enter image description here

以下是相关文件:

停止.sh

#!/bin/bash
pkill -f node

appspec.yml

version: 0.0
os: linux
files:
- source: /
destination: /var/www/
permissions:
- object: /var/www/
owner: root
mode: 777
hooks:
BeforeInstall:
- location: scripts/install.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/post_install.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/run.sh
timeout: 300
runas: root
ApplicationStop:
- location: scripts/stop.sh
timeout: 300
runas: root
ValidateService:
- location: scripts/validate.sh
timeout: 300
runas: root

以下是操作系统详细信息:

ubuntu@ip-172-31-2-33:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

我也尝试以 ec2-user 'ubuntu' 身份运行所有 Hook ,结果是相同的。

最佳答案

ec2-user 只是默认实例用户。在所有Linux中,如果没有首先发出sudo

,则无法执行任何系统命令

修复:

#!/bin/bash
sudo pkill -f node

关于node.js - 尽管以 root 身份运行所有内容,为什么 aws 代码部署会抛出 "No passwd entry for user ' ec2-user'"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42789567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com