Sometime is it we need to update Linx PS1
to make the server to recognize and here is a script to help you to do that. Updated PS1 will like [root@192.168.3.11]#
1 2 [root@192.168.3.11:~] Update /etc/profile Success! Please relogin your system for refresh...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 #!/bin/sh ifconfig eth1 >/dev/null 2>&1if [[ $? != 0 ]]then echo 'interface eth1 not exsit!' ; exit 1fi function Get_eth1IP () { if [[ $1 -eq 7 ]] then eth1_IP=$(ifconfig eth1 |awk '/inet / {print $2}' |awk '{print $1}' ) else eth1_IP=$(ifconfig eth1 |awk -F":" '/inet addr:/ {print $2}' |awk '{print $1}' ) fi }test -f /etc/redhat-release && grep 7 /etc/redhat-release >/dev/null 2>&1 && Get_eth1IP 7test -f /etc/centos-release && grep 7 /etc/redhat-release >/dev/null 2>&1 && Get_eth1IP 7 || Get_eth1IPecho $eth1_IP | grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" >/dev/null 2>&1if [[ $? != 0 ]]then echo 'eth1_IP is empty!' exit 1fi function Export () { echo "export PS1='\[\e[32m\][\u@${eth1_IP} :\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[32m\]]\[\e[m\]\\$ '" >>${1} && \ echo -e "\033[32m Update \033[0m \033[33m${1} \033[33m \033[32mSuccess! Please relogin your system for refresh... \033[0m" }function home_env () { if [[ ! -z $1 ]] then home=$1 else home=/root fi test -f $home /.profile && ( sed -i '/export PS1=/d' $home /.profile Export $home /.profile ) } userid=$(id | awk '{print $1}' | sed -e 's/=/ /' -e 's/(/ /' -e 's/)/ /' |awk '{print $2}' )if [[ $userid = 0 ]]then sed -i '/export PS1=/d' /etc/profile Export /etc/profile home_env else home_env ~fi