SUSE Support

Here When You Need Us

Fail to login ssh without password when using SSH Key-Based Authentication.

This document (000020760) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 12 all Service Packs
SUSE Linux Enterprise Server 15 all Service Packs

Situation

SSH Key-Based Authentication is configured. SSH login with SSH Key-Based Authentication fails and continues to prompt for a password.

As a demonstration, below, a "test" user on localhost creates a keypair and then copies it to remotehost.  However, the subsequent ssh attempt still prompts for a password.
test@localhost:~> ssh-keygen -t rsa
test@localhost:~> ssh-copy-id test@remotehost # Type the remotehost's test user password
test@localhost:~> ssh test@remotehost
Password:
Additionally, if the test user on the remote host attempts to configure SSH Key-Based Authentication, it fails with an error.
test@remotehost:~> ssh-copy-id test@localhost
/usr/bin/ssh-copy-id: ERROR: No identities found
A listing of the test user's home directory on the remote host shows:
test@remotehost:~> ls -al /home/test
total 4
drwxrwxrwx 1 root    root  34 Sep  7 22:24 .  <<--!! Note owner and permissions here !!
drwxr-xr-x 1 root    root  14 Sep  7 22:18 ..
-rw------- 1 test    users 95 Sep  7 22:24 .bash_history
drwx------ 1 test    users 54 Sep  7 22:31 .ssh

Resolution

Change the home directory owner from root to the user, and the directory mode from 777 to 755 on the affected server.
test@remotehost:~> sudo chown test.users /home/test
test@remotehost:~> sudo chmod 755 /home/test
test@remotehost:~> ls -al /home/test
total 4
drwxr-xr-x 1 test    users 34 Oct 19 20:32 .    <<--!! New settings in effect !!
drwxr-xr-x 1 root    root  14 Sep  7 22:18 ..
-rw------- 1 test    users 95 Sep  7 22:24 .bash_history
drwx------ 1 test    users 54 Sep  7 22:31 .ssh

Cause

Wrong user home directory permission and/or owner.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020760
  • Creation Date: 13-Sep-2022
  • Modified Date:19-Oct-2022
    • SUSE Linux Enterprise Server
    • SUSE Linux Enterprise Server for SAP Applications

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.