I have an issue where my customer used a different hostname naming convention than my company did, for the devices they purchased from us. Example:

We named the devices Lenny1, so the FQDN is lenny1.whatever.com and user@Lenny1 is what is visible to users when they log in to the device.

The customer used the name PCAP02 for this same device. This creates confusion for users when they log in and see Lenny1 as the system name.

For very complex reasons, we cannot easily change the /etc/hosts file to use the names that our customer uses. My question is, is there a way to spoof the system name that the customer will see, when they log in? This change needs to be purely cosmetic, so that the users won't get confused about what system they're logging in to.

1 Answer 1


You can change that in the /etc/bashrc file.

Please make a backup of this file in case you make any mistakes.

Within the file, you will see this line:

[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

\h is the hostname of the machine. Remove that and replace it with PCAP02.

That line should then look like this:

[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@PCAP02 \W]\\$ "

Save the file and enter bash and you will see user@PCAP02 in the terminal. Your customers will see the change when they SSH into the machines.

  • You are welcome. Glad to help. Commented Apr 12, 2018 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .