Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Ubuntu 12.04 server running. I created user1 when I installed, and created user2 today with '1useradd' and I added it to all the same groups as user1.

But when I log in remotely using SSH, the prompt for user1 looks like this:

user1@host:~$

And the prompt for user2 looks like this:

$

Most importantly, the shell doesn't behave as nicely as I'm used to when I'm logged in as user2. There is no autocomplete of commands or files with tab, and I can't access the MRU with up.

share|improve this question
    
Between adduser and useradd I always use adduser, it is the recommended "high level" routine, which also can/will create useful defaults for the new user, whereas useradd only generates the user and does nothing else. –  guntbert Jun 9 '13 at 20:33
add comment

2 Answers

up vote 2 down vote accepted

It is because their shell is set to /bin/sh, and not /bin/bash. You can use the program chsh (CHange SHell) to change that user's shell. When you're logged in as that user, run:

chsh /bin/bash

I would recommend against editing /etc/passwd manually as you could accidentally enter a syntactically wrong line in to it (without realising), which might break logins for other users.

share|improve this answer
    
I noticed that in /etc/passwd the entries look like: user1:x:1000:1000:user1,,,:/home/user1/bin/bash user2:x:1001:1001::/home/user2:bin/sh Do you know what the user1,,, does? csh didn't seem to change that part. –  Bill Jun 9 '13 at 17:10
1  
The comma-separated stuff is called Gecos data. It's used for things like room number, telephone number, and some other things. Running adduser actually prompts you for all of this info, but it's largely useless for you if this is just your personal computer. Check out this wiki link for a more complete explanation. –  Scott Jun 9 '13 at 17:41
add comment

Note: Use the method in the update, it's safer than manually editing passwd file.

the useradd command apparently sets /bin/sh as the default shell (which in turn is linked to /bin/dash). Try editing /etc/passwd and change /bin/sh to /bin/bash for user2.

In the future, use adduser instead.

UDPATE: As @Scott suggested below, instead of editing /etc/passwd use the chsh command:

chsh /bin/bash

Source: http://the-hydra.blogspot.com.ar/2012/03/useradd-and-adduser-are-same-think.html

share|improve this answer
    
That did it! So funny that useradd and adduser both exist. –  Bill Jun 9 '13 at 17:06
1  
What @Scott says is true. I forgot the chsh command. One should always try to avoid editing system files directly if there's a command that does that for us. Thanks! –  martintama Jun 9 '13 at 17:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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