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.
About this post
- Posted
- Archived
- Score
- 7 · 100% up
- Kind
- Text
- ID
- 71ghte
13 comments
Add them to /root/.profile and make sure the file is sourced (and that your service gets a shell environment).
Thanks. Can you point me to some examples as I do not want screw this up?
Examples for what exactly? Did you try to search google/arch wiki/ddg for the questions you have?
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.