0

I am new to Linux, I don't know in-depth things. I created a user from the root account, but I am not able to login as the new user (sampleUser). Here are the commands I used to create new user:

useradd  -m  -s  /usr/local/bin/bash  -d  /home/sampleuser   sampleuser
passwd sampleuser  
chown sampleuser.sampleuser sampleuser
chmod 777 sampleuser
  • 1
    Is bash really in /usr/local/bin? Not that it can't be, but that's a little unusual. If the shell isn't there, that could prevent login. – Jason Sherman Apr 6 '13 at 2:08
  • 1
    run sudo passwd in your terminal – dashboard Apr 6 '13 at 2:12
  • 1
    Are you able to ssh into it using your original login? Because in a lot of distros, ssh server is off by default and you have to manually bring it up. – YankeeWhiskey Apr 6 '13 at 2:30
  • If you aren't a super linux user, you can use shadow package, which provide an interactive command to create new users. The command is adduser and can configure your new user. – slackmart Apr 6 '13 at 3:51
  • While login are you getting any error? is bash really in /usr/local/bin ? or in /bin/bash ? add a user like this useradd sampleuser then passwdand try to login. – max Apr 6 '13 at 4:43
1

as root user, edit /etc/ssh/sshd_conf and see if you have lines starting with AllowUsers or DenyUsers keywords. If you do, add the new user name to the end of one of the AllowUsers lines.

| improve this answer | |
1

/usr/local/bin/bash is a remarkable place for a login shell but possible. Make sure it is there and make sure it is listed in /etc/shells. PAM or SSH might require this.

777 permissions on a home directory of a user with a login shell is not safe and could also be checked for valid logins by PAM for instance.

| improve this answer | |

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