Terminal Permission Denied Please Try Again
Introduction
The SSH Permission denied fault appears afterward permission-related settings are modified on the SSH server. Usual scenarios include a new parcel installation or the creation of new users.
In this tutorial, you volition learn how to troubleshoot the SSH Permission denied error and reconnect to your SSH server.
Prerequisites
- SSH customer on the local car and SSH server on the remote system
- A user account to access the remote server (for password-based login)
- A user account withsudo orrootprivileges
What is Causing SSH Permission Denied (publickey,gssapi-keyex,gssapi-with-mic)?
The SSH Permission denied mistake appears when trying to SSH into a server:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
Following the Permission denied statement, the bracket contains the attempted authentication methods that failed at the initiation of the connection. The error suggests that the public key is the effect, which is misleading.
1 reason for the mistake may exist sshd_config
, the file that contains SSH server configuration. The other possibility is that the authorized_keys
file has insufficient permissions. This file contains the list of public keys for the clients allowed to SSH into the server. Consequently, the system's disability to read from the file results in the Permission denied error.
How to fix SSH Permission denied
Both solutions comprise steps you need to perform on the server-side. Start by opening the concluding on your server and proceed with one of the solutions below.
Solution i: Enable Password Authentication
If yous want to use a password to access the SSH server, a solution for fixing the Permission denied mistake is to enable password login in the sshd_config
file.
To practise this, open up the file in a text editor. This example uses the nano editor:
sudo nano /etc/ssh/sshd_config
In the file, notice the PasswordAuthentication
line and make sure it ends with yes
.
Discover the ChallengeResponseAuthentication
option and disable it by adding no
.
If lines are commented out, remove the hash sign #
to uncomment them.
Relieve the file and exit.
Restart the SSH service past typing the following control:
sudo systemctl restart sshd
Solution ii: Change File Organization Permissions
Using the password-based login equally the SSH authentication method is non recommended due to security concerns. Therefore, the following solution may be preferable since it troubleshoots the public central hallmark method.
Offset, open the sshd_config
file using a text editor:
sudo nano /etc/ssh/sshd_config
In the file, make sure the post-obit options are ready as follows:
PermitRootLogin no PubkeyAuthentication yes
Annotation: The steps above are considered best security practices. If you need to use root login, set the relevant line to yes
.
Comment out the GSSAPI-related options by adding the hash sign at the beginning of the line:
#GSSAPIAuthentication yep #GSSAPICleanupCredentials no
Besides, make sure the UsePAM
line is ready to yes
:
UsePAM aye
Save the file and restart the sshd service:
systemctl restart sshd
Now navigate to your home folder and check the permissions:
ls -ld
If your owner permissions are non gear up to read, write, and execute ( drwx------
), use the chmod control to change them:
chmod 0700 /home/[your-username]
At present go to the .ssh
folder and recheck the permissions:
ls -ld
This directory should too accept read, write, and execute permissions for the file possessor. To enforce them, use chmod
over again:
chmod 0700 /dwelling house/your_home/.ssh
The .ssh
folder contains the authorized_keys
file. Check its permissions with:
ls -ld authorized_keys
The file owner should accept read and write permissions. To set them, use:
chmod 0600 /abode/[username]/.ssh/authorized_keys
At present try logging in with the fundamental pair once again. The output below shows a successful login attempt.
Determination
This tutorial covered the steps necessary to troubleshoot the SSH Permission denied (publickey,gssapi-keyex,gssapi-with-mic) error. By completing the steps in the guide, you should prepare the error and successfully SSH into your server.
Was this commodity helpful?
Yeah No
Source: https://phoenixnap.com/kb/ssh-permission-denied-publickey
0 Response to "Terminal Permission Denied Please Try Again"
Post a Comment