Generate valid openssh ssh key under windows - ssh

I've some persons that are under windows, and they need a public/private RSA keys pair in order to get them authenticated to gistosis, a GIT server. We use SmartGit as our GIT GUI, and this tool require the private key to be in the format of OpenSSH.
Using puttyGen, I've been able to get a openssh public key, that is printed in the window, but not a private key. I can only save a private key using the Save button, and it save a format that is not like the one we have using the *nix tool.
How can we use windows tool in order to generate a VALID openssh compatible public and private key ?
Thanks.

puttygen has a menu: Conversion -> Export OpenSSH Key That will save the private key to the openssh format.

Related

Can't connect to SFTP (with private key file) in Copy Data Tool

I am trying to copy data from SFTP to blob but got stuck when creating SFTP source.
I have the connection details and can easily connect on Filezilla or WinSCP. However, I am unable to get it to work in Azure data factory.
I am not using code but the user interface.
The connection details on the page creating the SFTP source:
Connect via integration runtime: AutoResolveIntegrationRuntime (default)
Host: xyz
Port: 22 (can't remove it as it doesn't like it)
SSH Host Key Validation: Enable SSH Host Key Validation
SSH Host Key Finger-print: taken from WinSCP - Session - Server/protocol information
Authentication type: SSH Public Key Authentication -can't use basic as the private key holds the security info
User name:XXX
Private Key Type: Use Key Content
Private key content: loaded the .ppk file, tried also tried loading the .pem file and got different errors
Pass Phrase: none
When setting up this sftp in WinSCP or FileZilla it automatically converted the provided .pem file into .ppk.
When I loaded the .ppk file into ADF I got an error: Invalid Sftp credential provided for 'SshPublicKey' authentication type.
When I loaded the .pem file I got: Meet network issue when connect to Sftp server 'spiderftp.firstgroup.com', SocketErrorCode: 'TimedOut'.
I have also tried 'Disable SSH Host Key Validation' in SSH Host Key Validation and made no difference.
I have also opened the .ppk file in PuttyGen and used that host key finger print and still no luck.
Only getting these 2 errors depending on which file I load.
Can't find anything about this online so would be grateful for some advice.
Have you read this note in this doc?
https://learn.microsoft.com/en-us/azure/data-factory/connector-sftp#using-ssh-public-key-authentication
SFTP connector supports RSA/DSA OpenSSH key. Make sure your key file content starts with "-----BEGIN [RSA/DSA] PRIVATE KEY-----". If the private key file is a ppk-format file, please use Putty tool to convert from .ppk to OpenSSH format.
Got this working today. Like you, could connect using WinSCP and failed when using ADF.
The link Fang Liu shared contains our answers, but my issue was not the private key. I suspect Fang's suggestion resolved your problem and I'm sharing my answer here to help others who may encounter similar.
My issue:
When using Private Key Authentication in ADF the password becomes a Pass Phrase and you no longer have the ability to supply a password. To overcome the problem we disabled password authentication for the user and the SFTP connection started working.
As stated in the documentation. The Pass Phrase is used to decrypt the private key if it is encrypted.
Also worth noting:
If you store the contents of the private key in Key Vault you need
to base64 encode the entire contents of the exported key and use
that string. This includes "-----BEGIN RSA PRIVATE KEY-----" and the
end. The same applies if you want to paste the value into the
textbox of the SFTP linked service edit screen.
I did not try to manually edit the JSON of the Linked Service to explicitly provide a password and this could be workaround for someone to test if they are unable to disable the password.
I used PuTTYGen to export the PPK to a private key and had the same fingerprint issue too so I just disabled cert validation. Funnily you can use the fingerprint provided by the error and it passes validation so not sure where the bug lies. :-)

WinSCP for ED25519 public key

I was trying to connect the server with my ED25519 public key, but it seems WinSCP doesn't support it, so the question is, how can I convert the key to the one supported by WinSCP?
WinSCP supports ED25519 key since beta 5.8.1 version. Try to download this version and it should work for you.
You can use different key types if you generate new pair. You can't convert ED25519 key to RSA (for example). They are completely different and there is no way how to get one from the other.

How do I set up ssh keys in Google Compute Engine?

I am trying to set up ssh keys through the Google Cloud Platform console.
I made a key in Puttygen,
but what is the format to paste it into the console?
I got this error:
Error: Invalid key. Required format: <protocol> <key-blob> <username#example.com>
After opening puttygen, select SSH-2 RSA and change the number of bits to 2048
Click on generate and follow the instructions
In the Key Comment textbox, put your email address
Fill in the passphrase boxes too for good practice
Save your private key somewhere
Copy all of the text from the top, greyed-out textbox
You should end up with the following in the google ssh keys textbox
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB5h1cM5uLB+1C7Al+RNuKoFz81P4mw89pYPDuARzZTNFPguHsfUNZ6Xtq2LF/CDoRh9G3Y9xt12H5TWdeZdmdaokwbtQYba86Ve7w0eLEw0Bwy4eQCC/hsVzNY37pUbdGBMbhOoYfJQ1gnz+4kZBtgNlk3PQiyWkBzBcIt6qHgd/ax8mS8Ty+0/cD1X50yEzyr/anP/WowZYIDb5rtM/+Rb/qZ6wZl1ka+AulT+9cH59ChHLDzeZc6NdJYhmS6K5DDebRaRWdviOiI+RpSMZz0hsHaGnQdpfrzswIwPolrA+nKQ24WZDPgWAzCAlvuLRdYB3dGDkLCnypAfHzwGyTj your#email.com
Then open putty, fill in the Session details and then go to Connection -> SSH -> Auth and click browse under Private key file for authentication.
After clicking open, your login name is the user part of your email address (before the #). It will ask you for your passphrase too.
In GCE, $gcloud compute ssh direct to /.ssh/google_compute_engine
so you might want to replace default gce file to the generated ssh file. You may also use a symlink to your actual key locations if you prefer.

How to convert generated Private Key in Openssh format to integrate subversion in IDEA IDE

I needed to generate a private/public key that is in openssh format to have me integrate subversion repository to IntelliJ. I have used puttyKeygen.exe already to generate a initial key. But while integrating in IntelliJ, its failing me to authenticate with a same Private key.
How can I convert the Putty generated private/public initial key to an openssh format. As I read, that the Subversion integration in IntelliJ uses the Cygwin/openssh format of the private key.
P.S: I have tried puTTykeygen to do the same but no luck! IDEA IDE still fails to authenticate.
Anyone who can shed some light on it would be really helpful.
Thanks!
EDIT
After going through the following steps to create an Openssh private key :
puttygen has a menu: Conversion -> Export OpenSSH Key That will save the private key to the openssh format.
I have again tried integrating the IDEA using the same key that got generated using above mentioned direction. and got myself failed with the same message saying authentication failed!
I am assuming, the key I obtained is either not openssh format or is there anything I am proceeding wrong with a integration. Could anyone please let me know what possibly could be the reason of me not able to integrate subversion in IDEA?
Make sure the initial keys that are put to use are one time generated not repeatedly.
Go to Puttykeygen-> conversions-> import the private key(.ppk file) you have generated initially and then-> export openssh key-> save it to the same location and then go to IDEA and follow the below steps:
1. Go to Version control-> Checkout from Version Control-> Subversion and provide the same key and your passphrase.
2. click checkout by providing your username.
It should work!

Can I use SSH keys in something other than PuTTy (on Mac)?

Bluehost only recommends PuTTy. However, is it possible to use ssh keys without any extra, visible programs in Mac?
I would like to have a connection to my server to be a breeze, so that I can control my server in Terminal.
Of course! On Unix and OS X, the ssh-keygen command will generate public and private keys for SSH public-key authentication. The usual way to invoke this command (on the client) is:
ssh-keygen -t rsa
This command will ask you where to place your private key; the default place is ~/.ssh/id_rsa, and the public key will be placed in the file of the same name with a .pub extension added (for example: ~/.ssh/id_rsa.pub). The command also asks you to create a password ("passphrase") for the private key; you can leave it blank for no password as I do, but I don't recommend this practice.
Once you have your public and private keys on the client computer, you need to make your server recognize that public key. If you have shell access to the server, you can upload the public key file with scp, then use ssh to run the following command on the server:
cat id_rsa.pub >> ~/.ssh/authorized_keys
If your hosting company doesn't give you shell access (though Bluehost does), or this procedure doesn't work, it will likely give you a web interface to the same functionality.
Once your server is set up to recognize your public key, it will allow you access without a password when ssh on the client tries to use your private key for authentication. You may still have to enter your private key's password, but typically you only need to do this once for each client login session.
Sure, I do this all the time. Just follow these directions to generate an SSH key and copy it to your server. The instructions should work on both Mac and Linux.
SSHKeychain is pretty much ideal for this. It lives unobtrusively on the menu bar and integrates seamlessly with OS X's Keychain and SSH implementations.
You will need to use ssh-keygen as described in other answers, but once you've done that you can use SSHKeychain to avoid having to type your private key passphrase all the time.
OpenSSH should be available to you on OS X; open a terminal and check out "man ssh". SSH keys get stored (in a format different from PuTTY) in ~/.ssh. Having a config in ~/.ssh/config can make your life easier, too; you'll be able to say "Use this $SHORTNAME for this $HOST using this $KEY" and similar.
At the terminal prompt do
$ apropos ssh
You should get a list of all the programs Mac OS X comes with related to ssh.
Using the ssh* tools, your ssh keys will be stored under ~/.ssh. PuTTY is nice, but compared to the standard OpenSSH tools, it's really only useful on Windows systems.
Sure can! First run:
ssh-keygen
And go through the steps. It is a good idea to give it a password and such. Then you can:
cat ~/.ssh/id_rsa.pub
and copy-paste the result into the bluehost public key textarea.