Created New user in Linux, but not able to login in putty or SSH or else

8,449

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

Solution 2

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

Share:
8,449
Kumar
Author by

Kumar

Updated on September 18, 2022

Comments

  • Kumar
    Kumar over 1 year

    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
    
    • Jason Sherman
      Jason Sherman about 11 years
      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.
    • dashboard
      dashboard about 11 years
      run sudo passwd in your terminal
    • YankeeWhiskey
      YankeeWhiskey about 11 years
      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.
    • slackmart
      slackmart about 11 years
      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.
    • max
      max about 11 years
      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.