[LINUX] (Vagrant) Handling of Permission denied (publickey, gssapi-keyex, gssapi-with-mic) error that occurs when connecting with SSH

Introduction

This article records my troubleshooting of the SSH connection I faced with CentOS 8 launched in a Windows 10 (1909), Oracle VirtualBox 6.0 + Vagrant 2.2.6 environment.

What I faced

When I tried to SSH to CentOS launched with VirtualBox using TeraTerm, I could not access it with a plain password.

Check SSH access log

Try to connect by specifying the option -vvv from PowerShell to output the log at the time of SSH access

ssh -vvv [email protected]



 Check the following log (partial excerpt)

PS C:\Vagrant\centos8> ssh -vvv [email protected] OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 debug3: Failed to open file:C:/Users/localadmin/.ssh/config error:2 debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2 debug2: resolve_canonicalize: hostname 192.168.33.10 is address debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to 192.168.33.10 [192.168.33.10] port 22. debug1: Connection established. debug3: Failed to open file:C:/Users/localadmin/.ssh/id_rsa error:2 debug3: Failed to open file:C:/Users/localadmin/.ssh/id_rsa.pub error:2 debug1: key_load_public: No such file or directory . . . debug1: Next authentication method: publickey debug1: Trying private key: C:\Users\localadmin/.ssh/id_rsa debug3: no such identity: C:\Users\localadmin/.ssh/id_rsa: No such file or directory debug1: Trying private key: C:\Users\localadmin/.ssh/id_dsa debug3: no such identity: C:\Users\localadmin/.ssh/id_dsa: No such file or directory debug1: Trying private key: C:\Users\localadmin/.ssh/id_ecdsa debug3: no such identity: C:\Users\localadmin/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: C:\Users\localadmin/.ssh/id_ed25519 debug3: no such identity: C:\Users\localadmin/.ssh/id_ed25519: No such file or directory debug1: Trying private key: C:\Users\localadmin/.ssh/id_xmss debug3: no such identity: C:\Users\localadmin/.ssh/id_xmss: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. [email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).


 Apparently the key to authenticate cannot be referenced


# The solution
 When ssh tried to refer to it, the RSA key did not exist in ``` C: \\ Users \\ localadmin / .ssh /` `` and the connection could not be made.
 Therefore, when the following procedure was performed on the new connection screen of TeraTerm, it became possible to connect.

 * Start TeraTerm
 * Select SSH to connect
 * Host is the IP address specified in Vagrant
    * ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/233495/b6aa9436-0dd4-8b56-d7a3-fd8d589c1aac.png)
 * Enter the user name on the "SSH Authentication" screen, set the radio button to "RSA / DSA / ECDSA / ED25519 Use Key", and press the "Private Key" button.
    * ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/233495/49d129a6-6cc9-95d3-c489-af6f0849fd44.png)
 * In this case, specify the "id_rsa" file under ``` Vagrant home folder \ host folder \ .vagrant \ machines \ default \ virtualbox```
 * Press the OK button to connect.


Recommended Posts

(Vagrant) Handling of Permission denied (publickey, gssapi-keyex, gssapi-with-mic) error that occurs when connecting with SSH
How to deal with SSL error when connecting to S3 with boto of Python
An error occurs when trying to import scikit-learn after connecting to Oracle with SQLAlchemy
Rollback processing when an error occurs with fabric
Summary of error handling methods when installing TensorFlow (2)