RHEL 7 Slow Login – Delay in SSH login


RHEL 7 Slow Login – Delay in SSH login 

Why does it take a long time to get on login prompt after successful authentication with ssh with correct credentials?

ISSUE:

  • It takes more than 20 sec to login with ssh
  • Delay happens after successful login authentication 
  • you find below error message in /var/log/secure 
sshd[19312]: pam_systemd(sshd:session): Failed to create session: Connection timed out

RCA:

  • pam_systemd create CreateSession method in systemd-logind via DBus, and this means systemd-logind is unable to reply pam_systemd.
  • Sometimes the machine gets stuck or hangs during boot or due to high load.
  • ‘systemd-logind’ following output error meaning, meaning that some directories have incorrect permission.
systemd-logind[681]: Failed to save session data /run/systemd/sessions/28: File exists
systemd-logind[681]: Failed to save user data /run/systemd/users/0: File exists

How To Fix This Login Delay in SSH:

  1. Check the permission of the below directories this should be 755, If not then fix it.
  • /run/user
  • /run/systemd/users
  • /run/systemd/sessions
After the above status if the issue not fixes then we have to restart the below services step by step to resolve this issue.

1. You have to reload the system login based daemon

 # systemctl daemon-reload

2. Check the health status of the inter-process communication daemon
# systemctl status dbus.service
# systemctl status polkit.service 
3. If the dbus and polkit service is not running then you will start the first polkit service then we will start the dbus service. Please make sure this will start in the same order.

# systemctl start polkit.service
# systemctl start dbus.service
4. In the last step we have to restart the systemd-logind service

 # systemctl restart systemd-logind

 
That’s it, now you have successfully fixed the issue. This is in the case when you have sufficient space in the root partition and load if optimal. If you have both issues then you have to fix them first. 
Now you have added one more troubleshoot option in your skill.

Share the article if it helps you !!!

35 thoughts on “RHEL 7 Slow Login – Delay in SSH login”

  1. I leave a response when I appreciate a article on a site or if I have something to add to the discussion. Usually it is caused by the fire communicated in the article I browsed. And after this post RHEL 7 Slow Login – Delay in SSH login -. I was excited enough to post a leave a responsea response 😉 I do have some questions for you if you do not mind. Is it simply me or do a few of these responses look like they are left by brain dead visitors? 😛 And, if you are posting on additional online sites, I’d like to follow you. Could you list the complete urls of all your public pages like your Facebook page, twitter feed, or linkedin profile?

  2. You have made some decent points there. I looked on the internet to learn more about the issue and found most people will go along with your views on this site.

  3. Generally I do not read article on blogs, however I would like to say that this write-up very compelled me to take a look at and do so! Your writing style has been surprised me. Thanks, very nice post.

Leave a Comment

Your email address will not be published.

Scroll to Top