Description

The QFabric DG shows a different prompt ' dg1 03:56:01~$ ' from the usual default prompt, which is ' [root@dg1 ~]# ' in QFX3100 devices.

This article explains the different prompts and how to change it back to the default prompt.

Symptoms

When Logging in to the DG via console or management interface, you should get the following prompt:

dg1 login: root
Password: 
Last login: Wed Jun  2 03:57:35 from 10.107.105.227
Juniper QFabric Director 13.1.9350 2020-08-28 18:31:41 UTC

[root@dg1 ~]# 

However, in some cases, the following prompt is displayed, which may lead to misinterpretation or confusion:

dg1 login: root
Password: 
Last login: Tue Jun  1 09:09:48 from 10.107.213.1
Juniper QFabric Director 13.1.9350 2020-08-28 18:31:41 UTC

dg1 09:52:24~$ 

Solution

The following lines in /root/.bash_profile is the cause for this behavior.

PS1='\e[1;36m\h \t\e[1;33m\w$ \e[m' 
alias dir="ls -last --color | more" 

Note: PS stands for prompt statement which changes the default prompt.  alias is to assign an alias for a Linux command

The different prompt in the display does not cause any impact, but it may lead to confusion for the user. To move to the usual default prompt, remove the last two lines in " /root/.bash_profile " file from the location as shown below:

  1. Check the contents of " /root/.bash_profile " file:

    dg1 09:52:24~$ cat /root/.bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin

    export PATH
    unset USERNAME

    PS1='\e[1;36m\h \t\e[1;33m\w$ \e[m'
    alias dir="ls -last --color | more"
  2. Remove the last two lines highlighted above from the file " /root/.bash_profile " by following the below steps.

    i. open the file using vi editor [vi /root/.bash_profile]
    ii. move the cursor to the line to be deleted and type dd in the keyboard
    iii. to save the changes use esc : wq keys in keyboard 
  3. Check the lines are deleted from file " /root/.bash_profile "

    dg1 10:02:10~$ cat /root/.bash_profile 
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    # User specific environment and startup programs

    PATH=$PATH:$HOME/bin

    export PATH
    unset USERNAME
  4. Exit and login back to the DG, the usual prompt appears

    dg1 10:02:10~$exit

    Juniper QFabric Director 13.1.9350 2020-08-28 18:31:41 UTC
    dg1 login: root
    Password: 
    Last login: Wed Jun  2 09:52:23 on ttyS0
    Juniper QFabric Director 13.1.9350 2020-08-28 18:31:41 UTC
    [root@dg1 ~]#