2

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?

3
  • can you put the values for $PS1 $PS2 $PS3 and $PS4 in your question? Put 4 spaces in front to display them unformatted. Commented Sep 4, 2015 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 Commented Sep 4, 2015 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 Commented Sep 5, 2015 at 7:23

2 Answers 2

3

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.

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

1
  • I always executed the command with the -m option. So the homfolder can't be the problem. Commented Sep 5, 2015 at 7:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.