/etc/environment and /etc/profile.d/* ignored for the root user

10,711

You will need to get into a real root login shell:

sudo su -
Share:
10,711

Related videos on Youtube

covariance
Author by

covariance

i can haz capchun?

Updated on September 18, 2022

Comments

  • covariance
    covariance over 1 year

    How do I set global environment variables in Ubuntu, in such a way, that they would apply also to root user?

    Setting PATH or JAVA_HOME in /etc/environment
    or in /etc/profile.d/my_settings.sh
    both works for usual user, but not for root.

    I'm logging in as root using sudo bash or sudo zsh.

    NOTE: using Ubuntu 10.04.

  • covariance
    covariance over 12 years
    I get an error: "Sorry, user [...] is not allowed to execute '/bin/su' as root on [...]"
  • enzotib
    enzotib over 12 years
    Have you used sudo before su?
  • Doktor J
    Doktor J almost 8 years
    @AleksandrDubinsky sudo su without the hyphen (not an en-dash or em-dash; that could break things) does not execute /etc/profile, which does not answer OP's question