← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1745978] [NEW] write_files recursively sets ownership to root:root, ignores owner directive.

 

Public bug reported:

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-g7acc9e68-0ubuntu1~16.04.1

Sample cloud config:

#cloud-config
write_files:
- content: |
    Example content.
  path: /home/ubuntu/example
  owner: ubuntu:ubuntu
  permissions: '0600'

Expected behavior:

A "/home/ubuntu/example" file is created, with "ubuntu:ubuntu" as owner
and a permission of 600. Permissions of the parent /home/ubuntu folder
do not change.

What actually happens:

A "/home/ubuntu/example" file is created, with an owner of "root:root" and a permission of 600.
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.

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Description changed:

  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
+ Provider: LXD (maybe/probably others too)
  
  Cloud-init version:
  17.1-46-g7acc9e68-0ubuntu1~16.04.1
  
  Sample cloud config:
  
  #cloud-config
  write_files:
  - content: |
-     Example content.
-   path: /home/ubuntu/example
-   owner: ubuntu:ubuntu
-   permissions: '0600'
+     Example content.
+   path: /home/ubuntu/example
+   owner: ubuntu:ubuntu
+   permissions: '0600'
  
  Expected behavior:
  
  A "/home/ubuntu/example" file is created, with "ubuntu:ubuntu" as owner
  and a permission of 600. Permissions of the parent /home/ubuntu folder
  do not change.
  
  What actually happens:
  
- A "/home/ubuntu/example" file is created, with an owner of "root:root" a permission of 600.
+ A "/home/ubuntu/example" file is created, with an owner of "root:root" and a permission of 600.
  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.

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1745978

Title:
  write_files recursively sets ownership to root:root, ignores owner
  directive.

Status in cloud-init:
  New

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-g7acc9e68-0ubuntu1~16.04.1

  Sample cloud config:

  #cloud-config
  write_files:
  - content: |
      Example content.
    path: /home/ubuntu/example
    owner: ubuntu:ubuntu
    permissions: '0600'

  Expected behavior:

  A "/home/ubuntu/example" file is created, with "ubuntu:ubuntu" as
  owner and a permission of 600. Permissions of the parent /home/ubuntu
  folder do not change.

  What actually happens:

  A "/home/ubuntu/example" file is created, with an owner of "root:root" and a permission of 600.
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1745978/+subscriptions