How to use WinSCP to connect to a Linux VM in Yandex Cloud with a key generated on VM creation
Case description
You need to use WinSCP to connect to a Linux VM in Yandex Cloud with a key generated on VM creation.
Solution
To connect to a Linux VM using WinSCP, specify these connection properties in your WinSCP:
File protocol:SCPorSFTP.Host name: VM IP address.User name: Username specified when creating the VM.Password: Leave blank, since you are going to use SSH key authentication.
Next, click Advanced, select SSH → Authentication, and then enable Allow agent forwarding in the Authentication parameters section. After that, in the Private key file field, select the SSH private key file and click OK. Now you can connect to the VM to transfer files via SCP or SFTP by clicking the Login button.
This above steps are relevant if you did not set a password for the user. If you have already connected to the VM using an SSH key and set a password using the sudo passwd username command, enter the user password on step 4 and click Login.
For security reasons, access to the VM is only possible through an SSH key by default.