Skip to content

Setting root environment variables

I need to set some environment variables for a application that runs as root. I have added them to /etc/environment, but when I su - into root, none of the entries from that file are present? The application (duplicati) runs as a service as root.

7 points13 comments
Open on Reddit
About this post
Posted
Archived
Score
7 · 100% up
Kind
Text
ID
71ghte

Author

78
posts
124
comments
16
media
View profile

13 comments

Add them to /root/.profile and make sure the file is sourced (and that your service gets a shell environment).

5 points

Thanks. Can you point me to some examples as I do not want screw this up?

0 points

Examples for what exactly? Did you try to search google/arch wiki/ddg for the questions you have?

2 points

You can perserve your users environment variables when you log into root. Look at su's manpage. If you need it ocasionally and don't work in root alot.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.