I started to learn linux and I came a cross problem I would like to ask. After I use useradd command in debian, I get new user with home directory. I check that directories from /etc/skel are copied and everything seems fine. But when I log to user with su - user I get only $ sign and I see that PS1 variable is not set, colours and other things. User created with adduser doesn't have this problem and If I check difference between .bashrc and .profile files for both users, there are the same. So why is this happening?
Asked
Active
Viewed 561 times
0
-
2Are you *certain* that you used the hyphen in the `su - user` ? – Jeff Schaller Feb 16 '18 at 20:05
-
1Relating: https://unix.stackexchange.com/q/121071/117549 – Jeff Schaller Feb 16 '18 at 20:06
-
1Which login *shell* was assigned to the user? – steeldriver Feb 16 '18 at 20:19
1 Answers
5
When you use useradd you have to specify all sorts of stuff - default shell, home directory, etc. If you aren't seeing a normal bash prompt, I would assume that you didn't specify /bin/bash as the user's shell and it defaulted to /bin/sh or similar.
To be honest, useradd is great for when you are adding users programmatically via a script. Not so great for one-off adding a single user.
Much better to instead use adduser newusername ....
ivanivan
- 4,870
- 1
- 9
- 20
-
`adduser` is good for scripted user creation too - just remember to use `--disabled-password` so it doesn't prompt for a password. You can set the password later with `echo user:pass | chpasswd`. – cas Feb 17 '18 at 00:23