Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
Distribution: A mash of SourceMage, Lunar, Slack, Manny, and RedHat all smushed together
Posts: 94
Rep:
path as su
trying to give su the proper path access while in a bash shell from a user account...my profile in /etc says:
PS1="${USER}@${HOSTNAME}>"
umask 0022
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/usr/local/kde/bin:/usr/local/qt/bin:/usr/local/jdk/bin
export PS1 PATH HISTSIZE QTDIR KDEDIR LS_COLORS QT_XFT TERM
The .bash profile in the user account I need su path properly set up in says:
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
Curently, when su as root within a user account there seems to be no path setup for root.
Any suggestions on how to correct this are appriciated!
Thanks for posting the answer, but for the record, how do I actuall edit the path? How exactly do you change the path variable? On this line of the .bash_profile file:
PATH=$PATH:$HOME/bin
because when I type $PATH at the command line, it gives me a MUCH longer path, I'm sure you know what I'm talking about, and I can find that path nowhere in the NHF file on editing your bash_profile. The NHF alludes to the fact that you need to change these files to get it done but never actually covers it. I even tried $PATH at the command line as well, and typing 'export' and then my new path - this was the advice of my dense buddies - but nothing worked. Your post answered my question and for grins I checked the man page for su, and there it is in black and yellow:
"A mere '-' implies -l. If no $USER is given, assume root"
Amazing things those man pages, but they never make much sense till someone explains them to you.
Originally posted by Atreyou40 How exactly do you change the path variable?
Well it's different on each distro it seems. On my Slack system all I do is edit /etc/profile There is an obvious line in there that I add the new entry to. On other systems it appears to be in /etc/profile.d You also can do the bash_profile deal, but I do believe that would only work if you are using bash, which to me isn't a great way to edit something.
I don't normally have a great need to add/remove from my default path variable all that often, so if I point someone towards a way to do it (on either Mandrake or RH) I usually point towards this how-to: http://www.mandrakeuser.org/docs/utils/ujava.html
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.