Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm rather new to the whole setting up a server, and hardening a server thing, but I had to start today. I mainly have experience with my ubuntu desktop.

Anyway, I just created a new user, that I intend to use to access the whole website, like this:

As root:

useradd -d /var/www/ example
passwd example
... (typing in the pw)

okey. Now, if I try to switch to this user, with

su example

I dont even get a password prompt, but only see a


The strange thing is, I apparently dont get a normal commandline like usual, but many things dont work: like syntax highlighting, auto completion with 'TAB', etc - on my ubuntu desktop, I instead get the normal example@...:~# line. What am I doing wrong?

share|improve this question

closed as off topic by mdpc, chutz, growse, Ward, thinice Dec 22 '12 at 20:25

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Google: /etc/skel. – quanta Dec 22 '12 at 13:15
You are missing some options that should be used in useradd. Please check the man pages for useradd. – mdpc Dec 22 '12 at 16:43
up vote 3 down vote accepted

All is fine sofar. Your new user has a different shell. You can verify with:

echo $SHELL

It is possilbe to change default shell of current user with :

chsh -s /bin/bash

Or with root can change shell of a user :

chsh -s /bin/bash example
share|improve this answer
Thank you a lot, worked! I prefer /bin/bash anyway, hehe – Katai Dec 22 '12 at 14:37

You are not doing anything wrong.

su is essentially an action which creates a shell within your current shell, not so much of switching within the current shell. And depending on the choice of shell being newly loaded now, it will behave differently. This is why when you exit from su, you return to the previous user; you simply exited the inner shell.

Additionally, su will not ask you for password if you do so from root because you are root.

share|improve this answer
Thank you, didnt know of that - I always tought it would just switch the user inside the same shell... ah well, still learning ;) – Katai Dec 22 '12 at 14:37

Some about SU command. If you are logged in as the user's root, you can always become another user without knowing the password. Become a example and stay in the current directory

[root@host ~]#su example

Become a exmaple and go to the user's home directory

[root@host ~]#su - example

Now if you try these commands from a non-privileged user will ask for the password.

What is $? This is shell

For default, in the your operation system used SH (shell wrapper). If you want to use the bash shell, then when the user, specify it:

[root@host ~]# useradd -s /bin/bash exmaple
share|improve this answer

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