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

Add example for non-root ownership for files & parent directories #450

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions modules/ROOT/pages/managing-files.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,33 @@ storage:
target: /opt/tools/transmogrifier
hard: false
----

.Example for how to set permissions and ownership for a file and its parent directories
[source,yaml]
----
variant: fcos
version: 1.4.0
storage:
files:
# This creates a file, and sets the ownership
- path: /home/directory/you/want.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a path with a name that matches the user and use a real configuration example like https://discussion.fedoraproject.org/t/ignition-when-a-file-is-created-parent-dir-is-still-owned-by-root/41222

contents:
inline: Hello, world!
user:
name: exampleuser
group:
name: examplegroup
# This creates the directory that the file should be inside. Its mode is set to 0755 by default, that
# is, readable and executable by all, and writable by the owner.
directories:
- path: /home/directory
user:
name: exampleuser
group:
name: examplegroup
- path: /home/directory/you
user:
name: exampleuser
group:
name: examplegroup
----
50 changes: 49 additions & 1 deletion modules/ROOT/pages/tutorial-user-systemd-unit-on-boot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ storage:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/.config/systemd/user/
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/.config/systemd/
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/.config/
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this one as it's created with the user.

mode: 0755
user:
name: sleeper
group:
name: sleeper
links:
- path: /home/sleeper/.config/systemd/user/default.target.wants/linger-example.service
user:
Expand Down Expand Up @@ -97,7 +121,31 @@ passwd:
storage:
directories:
- path: /home/sleeper/.config/systemd/user/default.target.wants
mode: 0744
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/.config/systemd/user/
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/.config/systemd/
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/.config/
mode: 0755
user:
name: sleeper
group:
name: sleeper
- path: /home/sleeper/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

mode: 0755
user:
name: sleeper
group:
Expand Down