EC2 Bootstrap 脚本未在 Ubuntu 上执行
EC2 Bootstrap script not executed on Ubuntu
我正在尝试使用以下 CLI 命令为 EC2 Ubuntu 机器设置 bootstrap 脚本:
#cloud-boothook
#!/bin/bash
sudo chmod 750 -R /home/
以上文本是通过 AWS 控制台在用户数据中设置的。
机器启动后运行,更改模式仍未被上述用户数据脚本修改。
尝试了替代命令:
Content-Type: text/cloud-boothook
Content-Type: text/x-shellscript
sudo chmod 750 -R /home/
仍然没有更改目录权限。
我的 objective 是在机器启动时使用 750
更改模式设置用户主目录。
如果有任何解决方案,我将不胜感激。
这是为我显示的错误消息:
[[0;32m OK [0m] Started Initial cloud-init job (pre-networking).
[[0;32m OK [0m] Reached target Network (Pre).
[[0;32m OK [0m] Started ifup for eth0.
Starting Raise network interfaces...
[[0;32m OK [0m] Started Raise network interfaces.
[[0;32m OK [0m] Reached target Network.
Starting Initial cloud-init job (metadata service crawler)...
[ 7.535726] cloud-init[1003]: Cloud-init v. 0.7.9 running 'init' at Sun, 29 Oct 2017 19:44:35 +0000. Up 7.23 seconds.
[ 7.548260] cloud-init[1003]: ci-info: ++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++
[ 7.565098] cloud-init[1003]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[ 7.580238] cloud-init[1003]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
[ 7.592760] cloud-init[1003]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[ 7.602150] cloud-init[1003]: ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . | . |
[ 7.613465] cloud-init[1003]: ci-info: | lo | True | ::1/128 | . | host | . |
[ 7.625404] cloud-init[1003]: ci-info: | eth0 | True | 172.31.19.221 | 255.255.240.0 | . | 06:ad:ba:ed:47:10 |
[ 7.635005] cloud-init[1003]: ci-info: | eth0 | True | fe80::4ad:baff:feed:4710/64 | . | link | 06:ad:ba:ed:47:10 |
[ 7.648580] cloud-init[1003]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[ 7.663022] cloud-init[1003]: ci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
[ 7.674192] cloud-init[1003]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
[ 7.682430] cloud-init[1003]: ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
[ 7.690935] cloud-init[1003]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
[ 7.703027] cloud-init[1003]: ci-info: | 0 | 0.0.0.0 | 172.31.16.1 | 0.0.0.0 | eth0 | UG |
[ 7.712719] cloud-init[1003]: ci-info: | 1 | 172.31.16.0 | 0.0.0.0 | 255.255.240.0 | eth0 | U |
[ 7.719950] cloud-init[1003]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
**[ 7.728024] cloud-init[1003]: 2017-10-29 19:44:35,859 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'b'Content-Type: text/cloud'...'**
[[0;32m OK [0m] Started Initial cloud-init job (metadata service crawler).
[[0;32m OK [0m] Reached target Cloud-config availability.
[[0;32m OK [0m] Reached target System Initialization.
[[0;32m OK [0m] Listening on D-Bus System Message Bus Socket.
Starting Socket activation for snappy daemon.
您正在递归地向 /home
分配 750 权限。
750 表示:
- 所有者可以读取、写入和执行。
- 组可以读取和执行。 (但不写)
- 世界可能不会对这个文件做任何事情。
/home
目录本身属于 root
,并且在 root
组中。因此,递归应用750后,只有root
可以访问/home
的内容(包括其他用户的主目录)。
所以,你真的不想那样做。
我正在尝试使用以下 CLI 命令为 EC2 Ubuntu 机器设置 bootstrap 脚本:
#cloud-boothook
#!/bin/bash
sudo chmod 750 -R /home/
以上文本是通过 AWS 控制台在用户数据中设置的。
机器启动后运行,更改模式仍未被上述用户数据脚本修改。
尝试了替代命令:
Content-Type: text/cloud-boothook
Content-Type: text/x-shellscript
sudo chmod 750 -R /home/
仍然没有更改目录权限。
我的 objective 是在机器启动时使用 750
更改模式设置用户主目录。
如果有任何解决方案,我将不胜感激。
这是为我显示的错误消息:
[[0;32m OK [0m] Started Initial cloud-init job (pre-networking).
[[0;32m OK [0m] Reached target Network (Pre).
[[0;32m OK [0m] Started ifup for eth0.
Starting Raise network interfaces...
[[0;32m OK [0m] Started Raise network interfaces.
[[0;32m OK [0m] Reached target Network.
Starting Initial cloud-init job (metadata service crawler)...
[ 7.535726] cloud-init[1003]: Cloud-init v. 0.7.9 running 'init' at Sun, 29 Oct 2017 19:44:35 +0000. Up 7.23 seconds.
[ 7.548260] cloud-init[1003]: ci-info: ++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++
[ 7.565098] cloud-init[1003]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[ 7.580238] cloud-init[1003]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
[ 7.592760] cloud-init[1003]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[ 7.602150] cloud-init[1003]: ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . | . |
[ 7.613465] cloud-init[1003]: ci-info: | lo | True | ::1/128 | . | host | . |
[ 7.625404] cloud-init[1003]: ci-info: | eth0 | True | 172.31.19.221 | 255.255.240.0 | . | 06:ad:ba:ed:47:10 |
[ 7.635005] cloud-init[1003]: ci-info: | eth0 | True | fe80::4ad:baff:feed:4710/64 | . | link | 06:ad:ba:ed:47:10 |
[ 7.648580] cloud-init[1003]: ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+
[ 7.663022] cloud-init[1003]: ci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
[ 7.674192] cloud-init[1003]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
[ 7.682430] cloud-init[1003]: ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
[ 7.690935] cloud-init[1003]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
[ 7.703027] cloud-init[1003]: ci-info: | 0 | 0.0.0.0 | 172.31.16.1 | 0.0.0.0 | eth0 | UG |
[ 7.712719] cloud-init[1003]: ci-info: | 1 | 172.31.16.0 | 0.0.0.0 | 255.255.240.0 | eth0 | U |
[ 7.719950] cloud-init[1003]: ci-info: +-------+-------------+-------------+---------------+-----------+-------+
**[ 7.728024] cloud-init[1003]: 2017-10-29 19:44:35,859 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'b'Content-Type: text/cloud'...'**
[[0;32m OK [0m] Started Initial cloud-init job (metadata service crawler).
[[0;32m OK [0m] Reached target Cloud-config availability.
[[0;32m OK [0m] Reached target System Initialization.
[[0;32m OK [0m] Listening on D-Bus System Message Bus Socket.
Starting Socket activation for snappy daemon.
您正在递归地向 /home
分配 750 权限。
750 表示:
- 所有者可以读取、写入和执行。
- 组可以读取和执行。 (但不写)
- 世界可能不会对这个文件做任何事情。
/home
目录本身属于 root
,并且在 root
组中。因此,递归应用750后,只有root
可以访问/home
的内容(包括其他用户的主目录)。
所以,你真的不想那样做。