Knowledgebase

SSH name

Posted by NoaHjk, 04-11-2009, 05:38 AM
Hi, when I login to SSH via Putty I see "bash-3.1#", how to change it to "root@something#" I use CentOS5 Thanks

Posted by vapetrov, 04-11-2009, 06:21 AM
read Bash Prompt HOWTO http://tldp.org/HOWTO/Bash-Prompt-HO...sequences.html

Posted by NoaHjk, 04-11-2009, 07:38 AM
I didn't find answer on my question there Any other help?

Posted by 040Hosting, 04-11-2009, 07:57 AM
Well the answer is there just a bit cryptic; just look at the variable which is set there, then go to your users .bash_profile and add this to it. Now every time the user logs into the system it will change to the prompt you did set. You can also change it system wide; check /etc/bashrc If you are not familiar with SSH and its commands great caution needs to be taken, there is not much anyone needs SSH for these days except for administrative tasks, if you are not familiar with bash or other shells (bsh, csh, tcsh, ksh, etc) i would advise to first learn about them or leave it to a system administrator to deal with. Example of what you want:

Posted by NoaHjk, 04-11-2009, 08:16 AM
Hey, my file is not like that(it works only if you are running cP/WHM on the server) Mine is like that: -bash-3.1# cat /etc/bashrc # /etc/bashrc # System wide functions and aliases # Environment stuff goes in /etc/profile # By default, we want this to get set. # Even for non-interactive, non-login shells. if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi # are we an interactive shell? if [ "$PS1" ]; then case $TERM in xterm*) if [ -e /etc/sysconfig/bash-prompt-xterm ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm else PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"' fi ;; screen) if [ -e /etc/sysconfig/bash-prompt-screen ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen else PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"' fi ;; *) [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default ;; esac # Turn on checkwinsize shopt -s checkwinsize [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " fi if ! shopt -q login_shell ; then # We're not a login shell # Need to redefine pathmunge, it get's undefined at the end of /etc/profile pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|$1($|" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } for i in /etc/profile.d/*.sh; do if [ -r "$i" ]; then . $i fi done unset i unset pathmunge fi # vim:ts=4w=4

Posted by 040Hosting, 04-11-2009, 08:25 AM
Setting a variable like PS1 has NOTHING to do with cpanel/WHM and i do not have clue why you say this. If you do not have a .bash_profile you may want to create one in your users directory, this is again no cpanel/WHM thing but pure bash; try: man bash for a manual. Once again, i would advise you to read a bit more about shells and shell scripting before making these changes on production environments as this seems to be new for you. Or ask someone to do this for you.

Posted by RoseHosting, 04-11-2009, 11:42 AM
Somehow you deleted the '/root/.bashrc' file. Login to your server and issue the following command after that: rsync -Waq /etc/skel/.bashrc /root/.bashrc or rsync -Waq --delete /etc/skel/{.bash_logout,.bash_profile,.bashrc} /root/ That is it. Next, just logout from your server and login again to it. I hope this will help.

Posted by NoaHjk, 04-12-2009, 03:35 AM
RoseHosting, it works. rsync -Waq /etc/skel/.bashrc /root/.bashrc .bash_logout, .bash_profile, .bash_history are there but I don't remember I deleted anything from /root dir Thank you a lot



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
ohtele? (Views: 633)
Tax Implications (Views: 549)


Language:

Client Login

Email

Password

Remember Me

Search