Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just created a new user as root with the command

    useradd newuser

I then assign a password with the command:

    passwd newuser

I assign password with success and then I open another shell window and attempt to login with the new user. Each time I get to the point where I enter my password I get permission denied. I've changed the password several times for this user but I still keep getting permission denied.

Anyone know what's going on?

share|improve this question
    
Can you su to the user from root? –  Tim May 27 '09 at 22:21
    
Did you add new user to some group? Did you create his own home directory with good privileges? Remove that user, and use these commands: sudo mkdir /home/newuser && sudo useradd newuser -d /home/newuser && sudo chown -R newuser:newuser /home/newuser –  Dawid Meyer Oct 22 '12 at 7:28

6 Answers 6

Look into (OSX: /var/log/secure.log, Debian: /var/log/auth.log) after you attempt to log in. What is the error?

Have you made sure he has an accessible home directory to log into?

share|improve this answer
    
Also what is the /etc/passwd entry for this new user? –  jabbie May 27 '09 at 22:24
    
what about fedora or redhat how do i look at the authentication log? –  Joe Estes May 27 '09 at 23:14
2  
RH based systems tend to use /var/log/secure by default. –  Scott Pack May 28 '09 at 11:38

I had this problem too, until I realized I had previously secured ssh through webmin by providing a list of users allowed to login... I changed the list, saved, shut down and restarted the ssh server... bingo, i'm in!

share|improve this answer

Your newly created user would also need a valid shell listed in /etc/shells.

getent passwd <username> | cut -d: -f7

Should yield sometihing like /bin/bash, /bin/sh, etc. (something listed in /etc/shells).

To change the shell for your newly created user could be done by using the chsh command, example to :

chsh -s /bin/bash <username>

share|improve this answer
    
I added a home directory and I think a shell is set by default because when I do grep user /etc/passwd i get the following: user:x:40626:40626::/home/dev/user:/bin/bash –  Joe Estes May 27 '09 at 23:16
    
This is really a comment to the comments to Ryan's answer, but don't have the rep to comment there. RH/Fedora uses /var/log/secure, if not 'grep auth /etc/syslog.conf' should tell you where it logs. –  kjetijor May 28 '09 at 1:20

After you added the home directory did you make sure to chown appropriately? ie: newuser would need their homedir chowned as follows:

chown -R newuser:(newusers's group) /home/newuser

Also, what do you get when you run the command id username ie:

id newuser

When you first create the account you should run it as follows to ensure the homedir is created, if it already exists it will notify you.

useradd -m newuser

share|improve this answer

What happens when you (as root) do: su - newuser ?

If that goes withouth flaw, logging in should work. At least you'll know if all the chowning above worked.

Regards,

share|improve this answer

How are you logging in? Via an SSH session to localhost? Can you log in as yourself with whatever method you use to log in as the user?

It may be a PAM issue, sometimes new installs do not have correct PAM configuration files for all methods (I've found taht some versions of both Debian and RedHat need to have the ssh PAM configuration amended to allow network login).

share|improve this answer

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.