1

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?

Leon Mydla
  • 31
  • 4
  • 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 04 '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` - http://unix.stackexchange.com/a/121072 – TessellatingHeckler Sep 04 '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 05 '15 at 07:23

2 Answers2

2

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.

Leon Mydla
  • 31
  • 4
0

First:
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).

Eddie Dunn
  • 463
  • 2
  • 9