SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just want to add cwd to path for all users. in my /etc/profile, I've pasted the portions involving the paths; however, adding the current dir or anything to default path and non-root users path still doesn't show up in path for all users. Yes I didn't forget to execute /etc/profile after editing it.
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games"
# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
export PATH=$PATH:.
fi
fi
Knock yourself out...i think it's a bad idea though, or else it would be default.
{edit} 'man bash' there's a default location for these kind's of thing's.
Don't get down on slackware...there's power to be had in text file's.
If you want to add the current working directory for all user's...
do 'true' ('man true')
it's already that way. :)
take note that 'man bash', there's a default location for these file's, i believe it's bash.rc or .bashrc.
It *is* the default, or it's supposed to be - the end of /etc/profile should read similarly to Tarts' quote - and Tarts' and this are not for root:
Code:
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
Adding it to root's path is not the best idea but if you want it for user, what the hell. Or maybe it wasn't the default and I uncommented it. I forget. Whatever. I think you'll need to re-source profile for it to work, though - I forget how to do that other than just logging out and logging in again.
Originally posted by digiot It *is* the default, or it's supposed to be - the end of /etc/profile should read similarly to Tarts' quote - and Tarts' and this are not for root:
Code:
# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
PATH="$PATH:."
fi
Adding it to root's path is not the best idea but if you want it for user, what the hell. Or maybe it wasn't the default and I uncommented it. I forget. Whatever. :) I think you'll need to re-source profile for it to work, though - I forget how to do that other than just logging out and logging in again.
Oh my mistake, i thought you wanted to add '.' to root's path. I hate to argue with you digiot, but i add my executable's dir. to root's path, i think that is ok. :) :) :)
{edit}
when i say my executable's dir. i mean my own executable's, the one's i make myself.
Add "." in the PATH is considered to be high risk of TrojanHorse.
Supposed some user on ur network or even an intruder is able to access certain location on ur sourceTree, maybe /var/ftp/incoming and put a shell script as "ls" with content "rm -rf /". That mean u ll need an new install after calling "ls" in that directory ..
That is why it is always recomended not to include "." in the PATH enviroment at all, that is why ppl must do "./configure" even if they are in the dir containing the configure script .. of any packaged they may have tried to install ..
Hm. I'm misreading all over the place. Well, the /etc/profile thing should work for users, anyway. Oof.
But go ahead and argue with me. I argue with conventional wisdom all I can but *nix permissions still utterly mystify me so I was just repeating what I understood as conventional wisdom there.
Originally posted by linuxJaver Add "." in the PATH is considered to be high risk of TrojanHorse.
Supposed some user on ur network or even an intruder is able to access certain location on ur sourceTree, maybe /var/ftp/incoming and put a shell script as "ls" with content "rm -rf /". That mean u ll need an new install after calling "ls" in that directory ..
That is why it is always recomended not to include "." in the PATH enviroment at all, that is why ppl must do "./configure" even if they are in the dir containing the configure script .. of any packaged they may have tried to install ..
But isn't the path searched *in order* of path listing? If '.' is on the *end* of your path it'll never *get* to the current directory before tripping over 'ls' in /bin first. So it wouldn't do anybody any good to stick a fake ls in a weird place. It isn't like DOS where the current directory is first.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.