If you need to use SSH or SCP with a different private key file, just specify it with -i. For example, to copy logs from a remote server using a specific private key file and user, do the following:
scp -i C:\Users\[your-user]\.ssh\pk_file [user]@[ip-addr]:/path/logs/* .
This -i will work regardless of OS, but the example is SSHing to a Linux server from a Windows server assuming you store your private keys in your user .ssh directory.
What is MRemoteNG?
MRemoteNG is a nice Windows OS tool for managing multiple SSH sessions (and session configurations) in one window – so you can log onto 10 servers and hop around trivially. It is built on top of Putty.
How Do You Use It With Azure VMs?
- When you create a VM in Azure, you give it a public key (assuming you didn’t use password authentication, which you should generally avoid).
- You can generate a key pair with PuTTYGen if you don’t have one (but then I’m assuming that you do have one if you already created the VM).
- Take the private key corresponding to that public key and save it into a file (it may already be in an “id_rsa” file in your .ssh directory in your user directory; e.g. C:\users\your-name\.ssh\id_rsa).
- Open PuTTYgen (it should come with MRemoteNG or Putty, otherwise you can get it yourself.
- Load the private key file.
- Click “Save private key” with Type = RSA selected (2048 bits is fine). It will save as a “PPK” file.
- Save it to your .ssh folder for consistency, or anywhere else – it really doesn’t matter much.
- Open MRemoteNG -> Tools -> Options -> Advanced -> Launch Putty -> Expand “SSH” -> Click Auth (Don’t expand) -> Put your PPK file path in “Private key file for authentication”.
- Click Session in putty and give the session a name in the “Saved Sessions” text box and then click Save. It should appear in the box below that.
- Now you have a saved session that can use this private key via a PPK file.
- Close Putty, make a new connection in MRemoteNG and select “Putty Session” = the new session you saved. It should be listed as an option.