Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user-level systemd unit example: /home/sleeper/.config is owned by root #367

Closed
eriksjolund opened this issue Feb 17, 2022 · 2 comments · Fixed by #460
Closed

user-level systemd unit example: /home/sleeper/.config is owned by root #367

eriksjolund opened this issue Feb 17, 2022 · 2 comments · Fixed by #460
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@eriksjolund
Copy link
Contributor

Regarding the example

https://docs.fedoraproject.org/en-US/fedora-coreos/tutorial-user-systemd-unit-on-boot/#_writing_the_butane_config_and_converting_to_ignition

variant: fcos
version: 1.4.0
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        - ssh-rsa ...
    - name: sleeper
storage:
  directories:
    - path: /home/sleeper/.config/systemd/user/default.target.wants
      mode: 0744
      user:
        name: sleeper
      group:
        name: sleeper
  files:
    - path: /var/lib/systemd/linger/sleeper
      mode: 0644
    - path: /home/sleeper/.config/systemd/user/linger-example.service
      mode: 0755
      contents:
        inline: |
          [Unit]
          Description=A systemd user unit demo
          After=network-online.target
          Wants=network-online.target
          [Service]
          ExecStart=/usr/bin/sleep infinity
      user:
        name: sleeper
      group:
        name: sleeper
  links:
    - path: /home/sleeper/.config/systemd/user/default.target.wants/linger-example.service
      user:
        name: sleeper
      group:
        name: sleeper
      target: /home/sleeper/.config/systemd/user/linger-example.service
      hard: false

The butane configuration does not explicitly create /home/sleeper/.config.
That leads to the directory being owned by root.

[esjolund@laptop fedora-coreos-docs]$ ssh  -p 2222 -o NoHostAuthenticationForLocalhost=true [email protected]
Fedora CoreOS 35.20220213.1.0
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/tag/coreos

[core@localhost ~]$ sudo -i
[root@localhost ~]# ls -ld /home/sleeper/.config/
drwxr-xr-x. 3 root root 21 Feb 17 22:18 /home/sleeper/.config/
[root@localhost ~]# 

The directory should instead be owned by sleeper:sleeper

@eriksjolund
Copy link
Contributor Author

eriksjolund commented Feb 17, 2022

Maybe butane could give out a warning when seeing that a root-owned directory
is being created inside a user's home directory?

Or maybe when missing directories need to be created, they could get the same ownership as the parent directory by default?

(I haven't given this much thought. I'm just sharing some ideas)

Instead of discussing future ideas in this GitHub issue, I added a comment here instead
https://discussion.fedoraproject.org/t/fedora-coreos-ignition-nested-directories-and-permissions-issue/37010?u=eriksjolund

@travier
Copy link
Member

travier commented Feb 28, 2022

I think we should move that to Ignition. WDYT @bgilbert ?
Edit: See #441

@travier travier added bug Something isn't working good first issue Good for newcomers labels Jun 8, 2022
eriksjolund added a commit to eriksjolund/fedora-coreos-docs that referenced this issue Sep 17, 2022
Add missing directories to Butane configuration

Adjust file permissions in Butane configuration

Fixes coreos#367

Signed-off-by: Erik Sjölund <[email protected]>
travier pushed a commit to travier/fedora-coreos-docs that referenced this issue Sep 19, 2022
- Add missing directories to Butane configuration
- Adjust file permissions in Butane configuration

Fixes: coreos#367

Signed-off-by: Erik Sjölund <[email protected]>
lucab pushed a commit that referenced this issue Sep 20, 2022
- Add missing directories to Butane configuration
- Adjust file permissions in Butane configuration

Fixes: #367

Signed-off-by: Erik Sjölund <[email protected]>

Signed-off-by: Erik Sjölund <[email protected]>
Co-authored-by: Erik Sjölund <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
2 participants