Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After running the hardening script, we are unable to log in with the root user credentials #357

Closed
rajualap opened this issue Jan 5, 2024 · 8 comments
Assignees

Comments

@rajualap
Copy link

rajualap commented Jan 5, 2024

{{ tools.context.actor }}: {{ tools.context.sha }}
After running the hardening script, we are unable to log in with the root user credentials and getting the below error

pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=127.0.0.1 user=root
Jan 5 06:18:23 ip-10-21-16-65 sshd[212573]: Failed password for root from 127.0.0.1 port 46442 ssh2
Jan 5 06:18:23 ip-10-21-16-65 sshd[212573]: fatal: Timeout before authentication for 127.0.0.1 port 46442
Jan 5 06:28:21 ip-10-21-16-65 CRON[223825]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Jan 5 06:28:21 ip-10-21-16-65 CRON[223826]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)

After giving to correct password also not able to login @konstruktoid

How to fix it i need to allow root user login.? Please help here

Thanks
Raju Alapati

@konstruktoid
Copy link
Owner

Hi @rajualap
That's correct, the root user aren't allowed to login in using ssh: https://github.com/konstruktoid/hardening/blob/master/scripts%2Fsshdconfig#L40

@rajualap
Copy link
Author

rajualap commented Jan 5, 2024

Hi @rajualap That's correct, the root user aren't allowed to login in using ssh: https://github.com/konstruktoid/hardening/blob/master/scripts%2Fsshdconfig#L40

@konstruktoid , Already we have enabled "PermitRootLogin yes" in sshd config file after not able to login
egrep '^[[:blank:]][^[:blank:]#]' /etc/ssh/sshd_config
Include /etc/ssh/sshd_config.d/
.conf
PermitRootLogin yes
PasswordAuthentication yes
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
AllowGroups analytics-team root ubuntu
AllowUsers analytics-team root ubuntu
root@ip-10-21-16-65:~#
How to allow root user login ?

@konstruktoid
Copy link
Owner

sshd[212573]: Failed password for root from 127.0.0.1

Correct password?

@konstruktoid
Copy link
Owner

But why login as root?
Instead of editing the script and configure files, why not login as a user and then elevate privileges?

@rajualap
Copy link
Author

rajualap commented Jan 5, 2024

@konstruktoid Yes correct password only using

this script create any impact on root user login "https://github.com/konstruktoid/hardening/blob/master/scripts/rootaccess"

@konstruktoid
Copy link
Owner

yes, https://linux.die.net/man/5/access.conf

but still, why use the root user?

@rajualap
Copy link
Author

rajualap commented Jan 5, 2024

yes, https://linux.die.net/man/5/access.conf

but still, why use the root user?

@konstruktoid , As per policy we need root user login access also. How to enable root user login ? hep me @konstruktoid

Thanks

@konstruktoid
Copy link
Owner

Have you changed the ssh configuration and the security file?

What does the logs say?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants