LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-29-2017, 01:44 AM   #1
compused
Member
 
Registered: Oct 2006
Location: Melbourne Australia
Distribution: centos and redhat 8
Posts: 91

Rep: Reputation: 15
pam_unix(sshd:auth): authentication failure;


Hi
can't get the *root password* accepted via 'ssh root@localhost' or via an ssh tunnel. But just running 'su root' in a putty session as a non-root user is successful. This is in a Centos7 minimal install. Would these be the relevant pam.d files?
ie /etc/pam.d/sshd:
Code:
auth       required     pam_sepermit.so
auth       substack     password-auth
auth       include      postlogin
# Used with polkit to reauthorize users in remote sessions
-auth      optional     pam_reauthorize.so prepare
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    include      postlogin
# Used with polkit to reauthorize users in remote sessions
-session   optional     pam_reauthorize.so prepare
and /etc/pam.d/password-auth-ac
Code:
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        required      pam_deny.so

account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     required      pam_permit.so

password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok


password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
This is the error message in /var/log/secure:
Code:
Nov 29 17:26:28 localhost sshd[19125]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost  user=root
Nov 29 17:26:28 localhost sshd[19125]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Nov 29 17:26:30 localhost sshd[19125]: Failed password for root from 127.0.0.1 port 59246 ssh2
Nov 29 17:26:32 localhost sshd[19125]: Connection closed by 127.0.0.1 port 59246 [preauth]
Any ideas anyone?
 
Old 11-29-2017, 10:41 AM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
root login via ssh is likely (and probably should be) disabled in /etc/ssh/sshd_config
Code:
PermitRootLogin no
 
Old 11-30-2017, 05:12 PM   #3
compused
Member
 
Registered: Oct 2006
Location: Melbourne Australia
Distribution: centos and redhat 8
Posts: 91

Original Poster
Rep: Reputation: 15
Have not got an answer re the pam config but have a workaround in terms of tunneling in via sftp.

Put the designated non-root user ('username' in the example below) into the sudoers file ie /etc/sudoers. You have to specify the location of the sftp-server binary. You edit /etc/sudoers via the visudo command line editor, as root:
Code:
username ALL=(ALL)	NOPASSWD: /usr/libexec/openssh/sftp-server
ie 'username' can run commands of any user (the first ALL) on any host (if there are more that one pc, on the network ie the second ALL) without a password but ONLY for sftp-server
(refer https://winscp.net/eng/docs/faq_su)

If using winscp as your sftp program, make the following changes
(refer https://forums.cpanel.net/threads/wi...ia-sudo.334882)
In WinSCP for the session of the particular user:
Environment -> SFTP [Protocol Options] - SFTP server:
Code:
/usr/bin/sudo -s /usr/libexec/openssh/sftp-server
Environment -> SCP/Shell [Shell] - Shell:
Code:
/usr/bin/sudo su
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pam_unix(sshd:auth): authentication failure marawu Linux - Security 1 09-20-2016 01:57 PM
SSSD and SSHD authentication failure gatsby Linux - Newbie 0 01-20-2016 03:45 AM
[SOLVED] SSH login failed pam_unix authentication failure error yogesh_attarde Linux - Security 3 05-19-2015 06:17 AM
pam_unix filling up auth.log Shwick Linux - Newbie 5 10-08-2008 08:38 PM
Repeated Log Entry: sshd: authentication failure; logname= uid=0 360 Linux - Security 1 10-07-2005 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration