6

I've created a new user profile with:

    useradd kitty
    passwd kitty
    mkdir kitty
    chmod 0700 kitty
    chown -R kitty:kitty
    adduser kitty sudo

    #when I did it I initially didn't notice I'm using two different commands,
    #hence the inconsequence, but as I've read up there are interchangeable anyway,
    #just listing it in case it actually makes any difference

I've also created a .bashrc file in kitty's home folder, with the contents of:

   export PS1='[\u@\h \w] '

Initially tab completion didn't work, and the prompt for kitty was a standard $ sign, and altough I've tampered with /etc/profile /etc/bash.bashrc /etc/bash_completion and created .bashrc in the home directory for both my main user and kitty, I've ended up reversing all the changes, and only leaving the .bashrc file in the kitty's home directory. So I guess it was the restart that resolved these isssues (sic.).

The problem now is: when I log in as kitty in the terminal window on my main profile, the prompt appears such as my main profile's, with all the formatting (color/boldness), but when I log in as kitty her native bash prompts have standard formatting. Why?

EDIT: as I've noticed there is also a slight difference in the content of prompt, the one on my main profile being followed by a $ sign and kitty's lacking the $ sign and being enclosed in square brackets.

I switch between profiles using sudo login and exit in the terminal window. When I log in as kitty at the start of the system, in the terminal it switches between the colored (logged as my main user) and standard (kitty's) one. If at the start of the system I log in as my main user it colors both (kitty's and main user's) in the same manner.

5
  • 1
    In the future, use adduser kitty rather than useradd kitty. adduser will create the homedir with proper ownership and permissions and all that; based on the config in /etc/adduser.conf.
    – geirha
    Aug 8, 2013 at 14:39
  • Given your latest edit, this is how I understand your question: you log in with your usual account and open a terminal window. You run the command sudo login and log in as kitty. You then get a shell with a colored prompt, which is surprising since nothing in kitty's profile says that the prompt should be colored. Is this correct? Aug 8, 2013 at 17:08
  • Have you changed /etc/bash.bashrc? Post the output of the following commands after sudo login as kitty: whoami; echo ~; echo "$PS1"; echo "$PROMPT_COMMAND"; cat ~/.bashrc Aug 8, 2013 at 17:11
  • I've checked for both cases, whoami returns kitty, echo ~ /home/kitty, $PROMPT_COMMAND comes back empty, cat ~/.bashrc returns export PS1='[\u@\h \w] '. The only difference is when I log in with kitty's account: [kitty@denuviel-Satellite-L650 ~] echo "$PS1" [\u@\h \w] and when I log in with denuviel's account kitty@denuviel-Satellite-L650 ~ $ echo "$PS1" ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] So why does it assume different values of $PS1?
    – denuviel
    Aug 8, 2013 at 17:34
  • 1
    @denuviel, because denuviel's account was created with all the bells and whistles (Using adduser or the "Users and Groups" GUI). kitty was created with useradd in which case you get a plain user without the default setup; you have to do all that tedious work manually.
    – geirha
    Aug 9, 2013 at 12:24

1 Answer 1

4

It looks like kitty's shell is /bin/sh. This is a shell that's intended for scripting, it doesn't support fancy prompts, completion, command line edition and other interactive features. Change kitty's shell to /bin/bash:

chsh -s /bin/bash kitty
10
  • I did change it, it indeed was /bin/sh initially, but it didn't make any difference, I've checked it is actually /bin/bash now by printing out the $SHELL
    – denuviel
    Aug 8, 2013 at 15:51
  • @denuviel Depending on how you change to the kitty account, the value of $SHELL may be carried over from your session. What does getent passwd kitty say? Aug 8, 2013 at 15:54
  • kitty:x:1001:1001::/home/kitty:/bin/bash
    – denuviel
    Aug 8, 2013 at 16:21
  • @denuviel Ok then. Please edit your question to explain how you log in as kitty (in the GUI login screen? over SSH?), how you start a shell, and copy-paste a prompt. Aug 8, 2013 at 16:25
  • 1
    @denuviel Well then, you do get the prompt that you configued in kitty's .bashrc. So what is your question about? Aug 8, 2013 at 16:31

You must log in to answer this question.

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