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 have 2 users, root and cecile. When i log in with either user i can access java or gedit from the command line. But if i log in as cecile and swap user to root and then back to cecile i am unable to access gedit or java.
Code:
cecile@rix:~$ which gedit
/usr/bin/gedit
cecile@rix:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr/share/texmf/bin:.:/usr/lib/java/bin/java:/usr/bin
cecile@rix:~$ su -
Password:
Penguin Trivia #46:
Animals who are not penguins can only wish they were.
root@rix:~# su cecile
cecile@rix:/root$ echo $PATH
/usr/local/bin:/bin:/usr/bin
In the above example cecile cant access java because it is not on her new path. But why can't she access gedit if its in /usr/bin ??? and where does she get this new path from ?
i get this error from gedit:
Code:
(gedit:1943): Gtk-WARNING **: cannot open display:
i have set the path for non root users in /etc/profile like this:
there's a section on which configuration file gets read when.
/etcprofile
~/.bash_profile
~/.bashrc
if a `source /etc/profile` fixes your path, then copy the relevant path statement to a file in the user's home directory named .bashrc, and it should be read when you plop back into your user.
thanks for the quick answers, ill check those out when i reboot out of windows. I know there are ways to fix the problem, most simply i could just open another bash shell.
Also if i was to login with cecile and then 'su - ' i can access java but not gedit.
In the above situation and with cecile 'gedit' is on their path, so why cant they access it ?
cecile@rix:~$ which gedit
/usr/bin/gedit
cecile@rix:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt-3.2.1/bin:/usr/share/texmf/bin:.:/usr/lib/java/bin/java:/usr/bin
cecile@rix:~$ su -
Password:
Penguin Trivia #46:
Animals who are not penguins can only wish they were.
root@rix:~# su cecile
cecile@rix:/root$ echo $PATH
/usr/local/bin:/bin:/usr/bin
Is there a reason you use su to go back to cecile instead of just typing "exit"?
sorry, my mistake Tinkster, well ive done a few searches but i cant find how i go about changing the display variable for root ?
and for the exit question the answer is no. im still a newbie and im teaching myself so thanks for pointing out that this isn't a good habit, i've since read 'man su'.
The path for su is restricted for security reason I bet. To make u have the root path as u have when login as root on console, u can append a line into your ~/.bashrc:
source /etcprofile
Append that also into ur ~cecile/.bashrc.
Note, init is the first process startet by the kernel, after awhile, init source the file /etc/profile, the first system wide PATH definition is defined in /etc/profile. This environment will be inherited to all login shell, that is why when u have not ~/.bashrc, ~/.bash_profile, u still have the correct path like it is in /etc/profile, well those scripts in /etc/profile.d/*.sh extends also the path during the PATH definition.
So my conclusion is, it is a good habit to source /etc/profile in ~/.bashrc and ~/.bash_profile b4 extra path are appended. This prevents also redudances of paths in $PATH also, because the PATH value will be set to null b4 it is redefined.
Hope that answer the path confusion, as for root display I have the problem also. That is possibly also made so for security reason.
Originally posted by dave bean
sorry, my mistake Tinkster, well ive done a few searches but i cant find how i go about changing the display variable for root ?
The easiest way would be
export DISPLAY=loclahost:0.0
Quote:
and for the exit question the answer is no. im still a newbie and im teaching myself so thanks for pointing out that this isn't a good habit, i've since read 'man su'.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.