write_files recursively sets ownership to root:root, ignores owner directive.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
New
|
Undecided
|
Unassigned |
Bug Description
The "write_files" cloud init directive tramples on folder permissions while ignoring the "owner" directive, resulting in wrong ownership of "root:root" being set all along the file path.
Provider: LXD (maybe/probably others too)
Cloud-init version:
17.1-46-
Sample cloud config:
#cloud-config
write_files:
- content: |
Example content.
path: /home/ubuntu/
owner: ubuntu:ubuntu
permissions: '0600'
Expected behavior:
A "/home/
What actually happens:
A "/home/
The "/home/ubuntu" folder now *also* has "root:root" as owner, resulting in a non-writable home for the "ubuntu" user.
The permissions should:
1) Honor the chosen user:group pair
2) Only set permission on parent folders if they do not already exist.
/var/log/ cloud-init. log -> https:/ /paste. ubuntu. com/26483428/
(notice the python stacktrace)
/var/log/ cloud-init- output. log -> https:/ /paste. ubuntu. com/26483440/