Skip to content

Commit

Permalink
Fix rustus systemd units not working with any user other than root (#3)
Browse files Browse the repository at this point in the history
rustus will refuse to work if it cannot write to its current working
directory, so now a directory that rustus has write access to (for
example the same directory where files will be uploaded) must be
provided for systemd units
  • Loading branch information
kysrpex authored Jun 15, 2023
2 parents eb2bf9a + 50dff08 commit cb2decc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ None.
user: myuser
# group that rustus will run as
group: mygroup
# rustus will refuse to work if it cannot write to its current working directory,
# just provide a directory that rustus has write access to (for example the same
# directory where files will be uploaded)
working_directory: /data/uploads
# arguments passed to rustus
args:
# see https://s3rius.github.io/rustus/configuration/
Expand Down
8 changes: 3 additions & 5 deletions molecule/systemd/vars.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
---
rustus_version: 0.7.2

# The systemd User= directive prevents users other than root from writing to the uploads folder,
# although strangely, when non-root users launch rustus without systemd everything works. Needs
# further investigation.
rustus_owner: root
rustus_group: root
rustus_owner: rustus
rustus_group: rustus

rustus_instances:
- name: uploads
user: "{{ rustus_owner }}"
group: "{{ rustus_group }}"
working_directory: "{{ uploads_dir }}"
args:
- --host "127.0.0.1"
- --port 10081
Expand Down
1 change: 1 addition & 0 deletions templates/rustus.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ UMask=022
Type=simple
User={{ item.user }}
Group={{ item.group }}
WorkingDirectory={{ item.working_directory }}
TimeoutStartSec=10
ExecStart={{ rustus_path }} {{ item.args | join(' ') }}
Restart=always
Expand Down

0 comments on commit cb2decc

Please sign in to comment.