6

Hi,

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?

2
  • Can you su to the user from root?
    – Tim
    May 27, 2009 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
    – dave
    Oct 22, 2012 at 7:28

6 Answers 6

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?

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

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>

2
  • 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, 2009 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, 2009 at 1:20
3

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!

1
0

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

0

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,

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .