LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Terminal Prompt Problem (https://www.linuxquestions.org/questions/linux-newbie-8/terminal-prompt-problem-459998/)

kissme1 07-01-2006 07:55 AM

Terminal Prompt Problem
 
hello everyone,
i am a newbie to red hat and working my way towards learning...i am having a problem that when i open the terminal in red hat linux 9 it shows me bash-2.05b instead of my login prompt i read a post in here about this issue in which the mod told the person to use

P1="[\u@\H \W]" and to include it in the end of bashrc to make it permanent...i added this line to the root's .bashrc file's end and also to the /etc/skel/.bashrc but whenever i restart i get the same prompt back i either have to do su or type the above command to get back to normal

acid_kewpie 07-01-2006 08:19 AM

the two files you've changed will have no effect on a normal user that already exists. that would be /home/username/.bashrc

kissme1 07-01-2006 10:27 AM

Quote:

Originally Posted by acid_kewpie
the two files you've changed will have no effect on a normal user that already exists. that would be /home/username/.bashrc

sir i always login as root and there is no direcotry for root in the home directory so what files should i change???i have changed the .bashrc in the /root folder but still nothing :(

Nylex 07-01-2006 10:33 AM

It should be PS1, not P1. You also need an "export" in there (i.e. the line should read "export PS1=[\u@\H \W]"). You shouldn't be logging in as root all the time either, make a normal account for everyday use.

acid_kewpie 07-01-2006 11:34 AM

you really shouldn't log in as root all the time, do you not appreciate how dangerous it is??

you also shouldn't call people sir if they have not been knighted, are your boss, or have the ability to put you in prison. :)

kissme1 07-03-2006 02:59 AM

Quote:

Originally Posted by Nylex
It should be PS1, not P1. You also need an "export" in there (i.e. the line should read "export PS1=[\u@\H \W]"). You shouldn't be logging in as root all the time either, make a normal account for everyday use.

well i usually use the root account cause i am used to logging in to windows using administrator previlages and the system i am using is acting as a network server for squid...is it still dangerous to login as root??? or should i use a normal account and switch to root when i need to change using the su command???and can u tell me what can be the drawbacks of logging in as a root user?

i will try using the export string with the command today

thanks

kissme1 07-03-2006 03:02 AM

Quote:

Originally Posted by acid_kewpie
you really shouldn't log in as root all the time, do you not appreciate how dangerous it is??

i really have no idea and knowledge on this would great
Quote:

Originally Posted by acid_kewpie
you also shouldn't call people sir if they have not been knighted, are your boss, or have the ability to put you in prison. :)

ok i understand mate :D i say sir cause most ppl dont like to be addressed straight :)like bro, man, mate etc

kissme1 07-03-2006 06:08 AM

ok i was able to remove that bash prompt but i have another problem what i try i connect through vnc to the system i get that .bash prompt again so i have to su to root or any other user but when i do that i i start getting Xlib: Invalid MIT-MAGIC-COOKIE-1 key messages and i cant run gui based programsany suggestions??

timmeke 07-03-2006 06:21 AM

The MIT-MAGIC-COOKIE issue is related to your xhost setup.
See
http://www.cygwin.com/ml/cygwin-xfre.../msg00220.html

Quote:

well i usually use the root account cause i am used to logging in to windows using administrator previlages
That's a very bad habit. Blame Microsoft for it.

If you're constantly logged in as root, you'll do plenty of stuff and may corrupt your system in doing so.
However, if you only temporarily use let's say su to switch to root for a particular job, you're likely to go back to your normal user after the job, thus limiting the risks of system corruption.
Also, keeping root logged in may leave your system vulnerable to additional remote attacks.
Thirdly, what happens if you temporarily go out of your office (assuming your computer is at your office), for instance to grab a cup of coffee? If you didn't remember to activate your screensaver (with password lock), then anyone who enters the room can completely erase your system in mere seconds.
Maybe you can trust your colleagues, and that is very good, but it's a proven fact that many outside "attacks" on networks actually have help from the inside.

To clarify the bashrc issue:
/etc/skel/.bashrc : is used as "default" bashrc settings whenever a new user is created.
root's .bashrc : may not be in /home/root, but for instance in /root instead. Check root's home directory by typing "echo $HOME" , "cd; pwd" or "grep root /etc/passwd" (to be called as root, except for the last one).
Putting the export PS1=... command in root's .bashrc or any user's .bashrc will make it apply only to root or to that user, and only if he's using the Bash shell.
If you want to use the new prompt settings for all users as default, try modifying /etc/bashrc instead.

Check out "man bash" for info on $PS1, $PS2, etc. to customize your prompts.
http://www.linuxjournal.com/article/3215 might help you too.

kissme1 07-03-2006 09:27 AM

thank you timmeke for a discrptive answer i would now login as a user and use su more :)

Quote:

Originally Posted by timmeke
The MIT-MAGIC-COOKIE issue is related to your xhost setup.
See
http://www.cygwin.com/ml/cygwin-xfre.../msg00220.html

i tried that and made a /etc/X0.hosts file and added the following lines to it
#/etc/X0.hosts
127.0.0.1
192.168.0.55(the ip i login via vnc to the system on which redhat is installed)

but still nothing
Quote:

Originally Posted by timmeke
try modifying /etc/bashrc instead.

Check out "man bash" for info on $PS1, $PS2, etc. to customize your prompts.
http://www.linuxjournal.com/article/3215 might help you too.

modified that file and added
export PS1="[\u@\H \W]"
to the end of it but i still get a bash prompt when i login via vnc to the system, when i access the system personally everything is good but via vnc(remotely) it still has a bash prompt :(

sorry for being so lame but everyone has to be dumb in something :)

timmeke 07-03-2006 10:32 AM

No need for the apologies, kissme1. You're here to get help with your Linux problems, and we're here to help you with them. No matter what the issue is, no matter how silly you think the problem is.
The fact that you are willing to work on your problem by listening to others is the first step towards the solution.
We all had to learn Linux by reading, practice and getting help at some point (or at least, I have).

Now, as for your problem:
did you also read the follow-ups on the link I provided you. Maybe they contain more clues.
Also, you may want to check your xhost settings.

Hmmm. VNC, as far as I know, only shows you what you would get to see if you were actually sitting at the computer itself. Yes, it requires a login to gain access, but it doesn't really log you on to the system itself. Are you sure it's VNC you're using? Not some other form of remote access like ssh, or ICA?

Anyway, my guess is that the bashrc and/or profile settings are simply not loaded when you connect remotely.
You can always load them by issuing a command like:
Code:

source /home/you/.bashrc
Can you find any related messages in /var/log?

kissme1 07-03-2006 10:44 AM

Quote:

Originally Posted by timmeke
Now, as for your problem:
did you also read the follow-ups on the link I provided you. Maybe they contain more clues.
Also, you may want to check your xhost settings.

any hints on how to do that :confused:

Quote:

Originally Posted by timmeke
Hmmm. VNC, as far as I know, only shows you what you would get to see if you were actually sitting at the computer itself. Yes, it requires a login to gain access, but it doesn't really log you on to the system itself. Are you sure it's VNC you're using? Not some other form of remote access like ssh, or ICA?

i am sure its vnc as i use the vncserver command to open it and i have added the whole command to /etc/rc.d/rc.local so it starts automatically and i dont have to go to the system to start it i use vnc client to connect to it and yes it doesnt log me in but whenever i open the system with vnc client the desktop is there even if i dont login the system itself(i.e.the ssytem is still at the startup screen but i am using it normally via vnc)

Quote:

Originally Posted by timmeke
Anyway, my guess is that the bashrc and/or profile settings are simply not loaded when you connect remotely.
You can always load them by issuing a command like:
Code:

source /home/you/.bashrc
did that too still no luck in vnc mode

Can you find any related messages in /var/log?


kissme1 07-07-2006 04:45 AM

ok i did some reading and found out that $root/.vnc/xstartup is the file that specifies X applications to be run when a VNC desktop is started. If it doesn't exist, vncserver will create a new one which runs a couple of basic applications.

i think that might be the problem cause i am not able to run the application that start with redhat-config extension

here is the xstartup file that i have so that u ppl can analyze and gimme some advice

#!/bin/sh

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc


any suggestions now??


All times are GMT -5. The time now is 08:38 AM.