I've designed my bash prompt like this \u@\h>

When i now create the User example with adduser, my prompt looks like example@host> But when i create a User with useradd, my prompt looks like \u@\h>

PS1: \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]

PS2: >

PS3: empty

PS4: +

Any ideas how to fix this?

  • can you put the values for $PS1 $PS2 $PS3 and $PS4 in your question? Put 4 spaces in front to display them unformatted. – Aaron Sep 4 '15 at 20:29
  • 2
    It sounds like adduser is giving the user a different shell compared to useradd, or some pre-configuration from /etc/skel - unix.stackexchange.com/a/121072 – TessellatingHeckler Sep 4 '15 at 21:20
  • Yes, i found it. The user which was created with useradd has the /bin/sh shell by default instead of /bin/bash – Leon Mydla Sep 5 '15 at 7:23

useradd creates users with the /bin/sh shell by default. If you want a different shell for the user, you just have to add the -s option like useradd -m -s /bin/bash {username} and you will be fine.


The attributes you have customized are inherited by .bash_profile and/or .bashrc in each users home directory so unless you modify the versions in /etc/skel the changes will only be good for the current user.
In response to your question:
My guess is that you simply do not have a home directory as unless you run useradd with the -m option it will not create the home directory (/home/user).

  • I always executed the command with the -m option. So the homfolder can't be the problem. – Leon Mydla Sep 5 '15 at 7:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.