SSHD | Server unexpectedly closed network connection | Putty

SSHD server unexpectedly closed network connection

Error log:
tail -f /var/log/audit/audit.log

type=USER_AUTH msg=audit(1292432614.589:14079): user pid=5965 uid=0 auid=0 ses=1 msg='op=PAM:authentication acct="user" exe="/usr/sbin/sshd" hostname= addr= terminal=ssh res=success'
type=USER_ACCT msg=audit(1292432614.598:14080): user pid=5965 uid=0 auid=0 ses=1 msg='op=PAM:accounting acct="user" exe="/usr/sbin/sshd" hostname= addr= terminal=ssh res=failed'
type=USER_LOGIN msg=audit(1292432614.600:14081): user pid=5965 uid=0 auid=0 ses=1 msg='op=login acct="user" exe="/usr/sbin/sshd" hostname=? addr= terminal=sshd res=failed'

Solution #1
#touch /etc/environment
creates the file

Solution #2
I had the same issue...I found that the IP of host I was trying to connect from was in /etc/hosts.deny
Check host file

Solution #3

after modifying the pam.d it started working for me

#cd /etc/pam.d
#vim  system-auth-ac

auth        required
auth        sufficient nullok try_first_pass
auth        requisite uid >= 500 quiet
auth        sufficient use_first_pass
auth        sufficient use_first_pass nolocal
auth        required

account     required broken_shadow
account     sufficient
account     sufficient uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore]
account     required

password    requisite try_first_pass retry=3
password    sufficient sha512 shadow nullok try_first_pass use_authtok
password    sufficient use_authtok
password    required

session     optional revoke
session     required
session     [success=1 default=ignore] service in crond quiet use_uid
session     required
session     optional

#vim sshd

auth       include      system-auth
account    required
account    include      system-auth
password   include      system-auth
# close should be the first session rule
session    required close
session    include      system-auth
session    required
# open should only be followed by sessions to be executed in the user context
session    required open env_params
session    optional force revoke

FOLLOW US :-    


Post a Comment