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.

user43312
  • 961
  • 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 08: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
  • @MartinBeseda - it was closed b/c, as the reason states, there are too many possible answers. That being said, when we close Q's doesn't mean we do not like them or think they're valuable, rather that they need to be better stated/defined so that the answers can be more concise. – slm Oct 25 '14 at 13:56
  • @user43312 - The Q is getting better. If we could get how the VM is setup networkwise then it should be in a more answerable state that will help you out. Can you SSH into the VM, does it have it's own IP from your DHCP router or is the IP from the VMware network? – slm Oct 25 '14 at 13:57

2 Answers2

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!

llua
  • 6,900
Eenoku
  • 1,165
  • 1
  • 12
  • 22
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.

John WH Smith
  • 15,880
Ray
  • 111
  • 4