I made a directory /opt
. How can I add it to the path for all users?
I tried adding it to /etc/profile
but it didn't work.
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt"
fi
export PATH
PATH
in their personal shell startup files – ilkkachu Dec 11 '17 at 18:41/opt
. @ilkkachu, that is not the case here. If a user does that, they deserve to have everything not work. – Michael Dec 11 '17 at 18:43zsh
orcsh
for example, they may not use/etc/profile
– Patrick Mevzek Dec 11 '17 at 19:46/etc/profile
should work. If it doesn't then I guess you should be able to debug it by putting aecho PATH=$PATH
at the beginning and at the end of all the shell config files (/etc/profile
,/etc/bash.bashrc
,~/.bashrc
, etc.). Note that you did not mention which shell you are using. – Tomáš Pospíšek Dec 11 '17 at 22:29