LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   New User added, bot not able to login via SSH (https://www.linuxquestions.org/questions/linux-server-73/new-user-added-bot-not-able-to-login-via-ssh-4175573934/)

Kumaresanpvk77 03-04-2016 01:30 AM

New User added, bot not able to login via SSH
 
Hi All,

I have added new user successfully. but not able to login.
Permission denied, please try again.

Can anyone pls help on this.

Kumaresan P

OregonJim 03-04-2016 01:58 AM

How did you create the new user? If by useradd on the command line, did you set the home directory and default shell?
Did you use passwd to assign the user a password? Is this user able to login locally?

Kumaresanpvk77 03-04-2016 03:01 AM

Yes, via command line
not given any directory or shell.

useradd kumsuser
passwd kumsuser

su kumsuser (happening from root)

But not new connection

fmattheus 03-04-2016 05:22 AM

Anything showing up in the log files?

dijetlo 03-04-2016 05:28 AM

not given any directory or shell.

I think if you assigned your user a home (login) directory you'd probably be able to ssh into the instance using the local users credentials.

Ramurd 03-04-2016 07:32 AM

Code:

grep kumsuser /etc/passwd
To see what shell is assigned; if you don't have a shell, you cannot log in (via ssh) I guess; but maybe a default shell is chosen; should be visible through /etc/passwd.

In case of no homedirectory, or homedirectory does not exist, it defaults to /; might be cause of the disconnect.
Then again, password logins from ssh may not be allowed and only public/private keys are allowed... so many reasons, so many solutions :-)

OregonJim 03-04-2016 11:59 AM

Quote:

Originally Posted by Kumaresanpvk77 (Post 5510002)
Yes, via command line
not given any directory or shell.

useradd kumsuser

Wilthout any options, this will (usually) simply assign a UID to the user - it won't give the user a shell, home directory, or default groups. That's why connecting via ssh fails. Some distributions differ in how they implement useradd.

You can use the "-D" switch with useradd to see the defaults, or set custom values as shown here:

http://www.computerhope.com/unix/useradd.htm

pan64 03-04-2016 12:03 PM

or use adduser instead of useradd

sundialsvcs 03-06-2016 07:56 AM

Consider also that ssh may require certain certificates or other information, which are (ordinarily) kept in a hidden .ssh directory in the user's home. This directory, if used, is required to exist and to have specific permissions. Probably your user-add process would not have set up these additional things.

Kumaresanpvk77 03-07-2016 11:24 PM

I don't understand what is exactly happened, first one user added successfully with id 500, which i cant login. then i created one more with id 501 that i can login . Then i deleted first one and created the same name with id 502 which is now successfully logged in.

Can anyone explain..?

fmattheus 03-08-2016 02:01 AM

Going back to my post from 4 days ago ...
Quote:

Originally Posted by fmattheus (Post 5510046)
Anything showing up in the log files?

Specifically in the /var/log/auth.log at the time of a login attempt.

Kumaresanpvk77 03-09-2016 12:57 AM

auth.log file not available, in secure.log file below lines printed


Mar 4 06:31:06 EDMS userdel[16734]: delete user 'kumsuser'
Mar 4 06:31:06 EDMS userdel[16734]: removed group 'kumsuser' owned by 'kumsuser'
Mar 4 06:31:28 EDMS useradd[16741]: new group: name=kumsuser, GID=500
Mar 4 06:31:28 EDMS useradd[16741]: new user: name=kumsuser, UID=500, GID=500, home=/home/kumsuser, shell=/bin/bash
Mar 4 06:32:04 EDMS passwd: pam_unix(passwd:chauthtok): password changed for kumsuser
Mar 4 06:33:05 EDMS sshd[16756]: pam_tally2(sshd:auth): user kumsuser (500) tally 19, deny 3
Mar 4 06:33:07 EDMS sshd[16756]: Failed password for kumsuser from 10.50.11.178 port 40959 ssh2
Mar 4 06:33:09 EDMS sshd[16756]: Failed password for kumsuser from 10.50.11.178 port 40959 ssh2

fmattheus 03-09-2016 02:12 AM

Seems pretty clear that the password is incorrect. Maybe you're using the wrong keyboard layout, and a 'z' is being used instead of a 'y', for example?

sgrlscz 03-09-2016 08:20 AM

The pam_tally2 line in secure.log indicates the account was locked due to too many failed login attempts. It was locked after the 3rd attempt, so even if you entered the correct password after that, it wouldn't let you in until the account is unlocked. The pam_tally2 command is used list the current failed login tallies and to unlock the account.

Kumaresanpvk77 03-09-2016 11:30 PM

Same user I deleted and recreated but then also not able to login, then i decided to create one more user now id is 501 and able to login. Now deleted the id 500 user. and created with same user name and id become 502, now able to login with that user name.


All times are GMT -5. The time now is 09:02 AM.