2

Used to be "root@localhost". The system is CentOS Release 6.4 in a VMware virtual machine. Yesterday I did some test of the user and group commands. And I noticed the tty1 login prompt changed to be "bogon login". And then the pts prompt changed after that. My question is how to change it back?

Since the prompt change was not due to my deliberate modification to variable PS1, I suspect that there must be some reason for this. I want to dig it out and thus prevent future auto change to the "bogon" name again. Also, I want to know the what the word bogon stands for.

As I indicated in the comment, this is not the first time that happened to my Linux virtual machine. Yes, the virtual machine is connected to a DHCP wifi router.

closed as too broad by jasonwryan, mikeserv, Braiam, slm Oct 24 '14 at 4:34

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Well, thank you all there answering my question. I did not change the hostname myself when the prompt changed to bogon. As @MartinBeseda pointed out, the problem could be solved by changing the variable. So I guess maybe I should dig it a little deeper, say, I should change the $HOSTNAME variable. Is that right? – user43312 Oct 23 '14 at 22:57
  • IF you did not explicitly set the hostname, then did you connect the system to a server (DHCP) that provided it w/ an IP address? – slm Oct 23 '14 at 23:22
  • Oh, why was this question put on hold? I think the question itself is perfectly specific - "how to change it back?" Yes, it's beginners' question, but I think it should be here, lots of newbies with Unix will appreciate it, I suppose. – Eenoku Oct 24 '14 at 15:25
  • Thank you, @MartinBeseda. Sometimes newbies feel embarrassed with a simple question. – user43312 Oct 25 '14 at 8:57
  • Yes I have connected it to a DHCP server, @slm. And this is not the first time that this happened. – user43312 Oct 25 '14 at 10:31
1

You can simply try this command:

PS1='root@localhost '

The point is, that your prompt is stored as a string in the system variable PS1. If you want to see it, you can simply type:

echo $PS1

If you see some strange symbols, don't be afraid, it's perfectly normal here.


For example:

\h - represents your hostname

\d - represents current date

\u - represents your username

So, this code:

PS1='[\h@\u]:\$' 

makes my prompt look like this:

[martin-Aspire-E1-531@martin]:$

If you want to know a lot more than my brief example, you can simply read it here.

And finally, if you're satisfied with your prompt, you must save your 'PS1="root@localhost "' into ~/.bashrc file!

0

If you changed your hostname to 'bogon' that is why the prompt changed. If you want you can modify the $PS1 variable in /etc/bash.bashrc to always show username@localhost instead of username@hostname.

Not the answer you're looking for? Browse other questions tagged or ask your own question.