The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SSH Help

Discussion in 'General Discussion' started by JZM, Jan 28, 2010.

  1. JZM

    JZM Member

    Joined:
    Aug 17, 2007
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hey,

    I have a SSH issue:

    After I login to SSH it shows -bash-3.2. How can I change it to show user@domain

    Jess
     
  2. stegre

    stegre Registered

    Joined:
    Jan 28, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I have the same problem. All the new accounts are missing the ~/.bashrc file... Why cPanel?

    I fixed this by copying the file from another account, and setting the correct owner.

    Here are the contents of my ~/.bashrc file:

    Code:
    # .bashrc
    
    # Source global definitions
    if [ -f /etc/bashrc ]; then
            . /etc/bashrc
    fi
    
    # User specific aliases and functions
    
     
  3. JZM

    JZM Member

    Joined:
    Aug 17, 2007
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    How do I change the owner?
     
  4. stegre

    stegre Registered

    Joined:
    Jan 28, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Code:
    chown jessuser:jessgroup .bashrc
     
  5. deieno

    deieno Well-Known Member

    Joined:
    Nov 16, 2003
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Floripa - Brazil
    Anyone knows how to fix that?
    I mean.. copy .bashrc from ~/.bashrc is a fix, but, do I have make this on all new shell accounts?

    is possible to fix it for new accounts?
     
  6. cPanelJamyn

    cPanelJamyn Social Engineer
    Staff Member

    Joined:
    Jan 29, 2009
    Messages:
    105
    Likes Received:
    2
    Trophy Points:
    0
    Hi,

    First, consider using the system-wide bashrc, usually saved at /etc/bashrc. Update that file, and users should automatically use these changes when they login, without the need to copy a file per-user. For example, you can set PS1 for the default prompt in /etc/bashrc:

    PS1="\u@\h [\w] $ "

    For 95% of users, this is what they want. However, if you really need to specifically copy a .bashrc file per-user (which of course will be harder to maintain if you have a lot of users and decide to change the format), then save it to /etc/skel/ so it's copied during account creation. Ex:

    a) create a custom .bashrc
    b) copy .bashrc it to /etc/skel/ so it will be used on new account creation.

    Example:
    # cp ~/.bashrc /etc/skel/

    Hope this helps!
     
  7. deieno

    deieno Well-Known Member

    Joined:
    Nov 16, 2003
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Floripa - Brazil
    Hi.. I just tested,

    /etc/skel already has the .bashrc

    and than I tried to create a test account, but .bashrc wasn't there on the new account.

    Any tip to fix that... cause this probably is the main reason from the issue.
     
  8. cPanelJamyn

    cPanelJamyn Social Engineer
    Staff Member

    Joined:
    Jan 29, 2009
    Messages:
    105
    Likes Received:
    2
    Trophy Points:
    0
    Hi,

    No problem. Ensure it's also saved to the cPanel 'skel' folder, so it's copied for accounts created through WHM as well. Example:

    Code:
    # [B]cp ~/.bashrc /root/cpanel3-skel/[/B]
    # [B]cp ~/.bashrc /root/cpanel3-skel/.profile[/B]
    
    Depending on the environment, .profile may be read instead of .bashrc in some cases. Thanks!
     
  9. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Actually /etc/bashrc is an accepted standardization but is not actually loaded on interactive shells (IE: real people logins vs. scripts) unless explicitly loaded which is typically done from the ~/.bash_profile

    However if both the ~/.bash_profile and ~/.bashrc are missing then you are a bit S.O.L. if you are hoping to have the /etc/basrc auto load for users
     
  10. gkgcpanel

    gkgcpanel Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    217
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    System wide /etc/bashrc is different from default CentOS install

    Just noticed something very strange. On all of our cPanel servers, the default /etc/bashrc file (that is installed with CentOS 5) is installed. We don't allow our users SSH access.

    Two of the newest servers however, have a very different copy of /etc/bashrc

    # System wide functions and aliases
    # Environment stuff goes in /etc/profile

    # For some unknown reason bash refuses to inherit
    # PS1 in some circumstances that I can't figure out.
    # Putting PS1 here ensures that it gets loaded every time.
    alias which="type -path"
    export EDITOR="vim"
    export VISUAL="vim"
    PS1="\u@\h [\w]# "

    whoami=`whoami`
    if [ -e "~/.dns" ]; then
    DNS=`cat ~/.dns`
    PS1="\u@$DNS [\w]# "
    else
    if [ -e "/var/cpanel/users/$whoami" ]; then
    eval `grep DNS= /var/cpanel/users/$whoami`

    if [ ! "$DNS" = "" ]; then
    echo -n "$DNS" > ~/.dns
    PS1="\u@$DNS [\w]# "
    fi
    fi
    fi

    if [ ! -e ~/public_html/cgi-bin ]; then
    mkdir -p ~/public_html/cgi-bin
    fi
    if [ ! -e ~/public_ftp ]; then
    mkdir -p ~/public_ftp
    fi

    #mesg y

    alias wtf="watch -n 1 w -hs"
    alias wth="ps -uxa | more"
    # Now for the dos users
    alias dir="ls"
    alias copy="cp"
    alias del="rm"
    alias deltree="rm -r"
    alias move="mv"
    alias ff="whereis"
    alias attrib="chmod"
    alias edit="pico"
    alias chdir="cd"
    alias mem="top"
    alias search="grep"
    alias pico="pico -w -z"


    LS_OPTIONS='--color=tty -F -a -b -T 0';
    export LS_OPTIONS;
    alias ls='/bin/ls $LS_OPTIONS';
    alias dir='/bin/ls $LS_OPTIONS --format=vertical';
    alias vdir='/bin/ls $LS_OPTIONS --format=long';
    alias d=dir;
    alias v=vdir;
    eval `dircolors -b`


    export JAVA_HOME=/usr/local/jdk
    export PATH=$JAVA_HOME/bin:$PATH
    export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
    export PATH="$PATH:/usr/local/bin:/usr/X11R6/bin"

    This is *NOTHING* like the one that is installed by CentOS. I noticed this line:

    if [ -e "/var/cpanel/users/$whoami" ]; then
    eval `grep DNS= /var/cpanel/users/$whoami`

    Which seems to indicate that cPanel must have somehow over-written the default CentOS /etc/bashrc.

    Can cPanel verify this???

    If so, why are the rest of our cPanel servers using the default /etc/bashrc from CentOS install and only our most recent 2 cPanel servers have this new one???

    Thanks,
    Peter
     
  11. gkgcpanel

    gkgcpanel Well-Known Member

    Joined:
    Jun 6, 2007
    Messages:
    217
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    Bump

    Anyone.... ??? Bueller???
     
  12. asent

    asent Active Member

    Joined:
    Apr 5, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    I didn't notice the default be overwritten on my boxes.

    Are they jailed users?
     
  13. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    I don't think this is either a CentOS or a Cpanel matter and not sure there is much use or point to this thread other than my seeing it ....

    What you posted looks very, very much like a partial segment from one of my own very frequently requested shell modifications which among other things gives live system status read outs at the prompt.

    (It may not be it at all but it does look very much like one in particular)

    However, the modification I am thinking about is not placed in the /etc/bashrc so if that is the file you are reading from it would seem someone may have tried to install that particular mod and possibly put it the wrong place.

    If you are not reading from the /etc/bashrc then ignore the last comment.

    In any case, you should contact me and I can probably help you sort out your questions and confirm if the mods I mentioned are deployed on the new servers that you just mentioned which is certainly possible since I work with a great many server providers. :)
     
Loading...

Share This Page