![]() |
$PATH problem (probably)
Hi,
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 i get this error from gedit: Code:
(gedit:1943): Gtk-WARNING **: cannot open display: Code:
PATH="$PATH:.:/usr/lib/java/bin/java:/usr/bin" |
That's because you used
su cecile rather than su - cecile That way cecile inherits root's display variable which probably isn't set. But why don't you 'exit', rather than running up a sequence of su's? Cheers, Tink |
I know this is a non-answer but...
Code:
man bash /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 ? |
Quote:
Quote:
Quote:
Cheers, Tink |
Re: $PATH problem (probably)
Quote:
|
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. |
hi, thanks for the advice but either i don't understand or i don't have the dir
~/.bashrc (im viewing hidden files or ls- a) |
Quote:
export DISPLAY=loclahost:0.0 Quote:
Cheers, Tink |
All times are GMT -5. The time now is 07:49 PM. |