6/21/2023 0 Comments Git bash ssh copy id![]() ssh/authorized_keys || exit 1" > /tmp/t.txt" copy the file to the target linux system using the sshĬredits to for his answer c:\>ssh "umask 077 test -d. I changed the name of the public key to "id_rsa"Ģ. That created an identity file in the home directory. create identity (on windows) c:\>ssh-keygen # "" /script=".\Scriptname" /parameter "id_rsa.pub" "ġ.Select Host, right click, external tools, select Scriptname.I also have a winscp script that can be used as per another answer. Inspired by zoredache's answer, I've created a bunch of scripts that are the windows version. Where id_rsa.pub is the filename of the public key you uploaded. ssh/authorized_keysĪlternatively, you could upload the file using WinSCP (which uses sftp, or scp as a fallback) and do something similar to my previous suggestion, without the ugly copy/pasting. You could do this yourself by opening the key file with a text editor and pasting the contents in the Kitty terminal.Įcho 'long_line_with_contents_of_public_key_file' >. Ssh-copy-id does a couple of things (read the man page for details), but the most important thing it does is append the contents of your local public key file to a remote file called authorized_keys. ssh is not yet created on the host machine, use this small variation:Ĭat ~/.ssh/id_rsa.pub | ssh "mkdir ~/.ssh cat > ~/.ssh/authorized_keys" I had created a public key on my client machine in git bash and was trying to copy it to a VPS.Īfter creating your public key, the key should be stored as "(whatever folder you started in)/.ssh/id_rsa.pub"Ĭat ~/.ssh/id_rsa.pub | ssh "cat > ~/.ssh/authorized_keys" where user is your username (sometimes "root", or whatever you may have set up), and replace 123.45.67.89 with your machine / host / VPS's IP address. ![]() If you want to do all the same error handling, and the automatic key location, I am sure writing a script under Windows will be a lot trickier, but certainly possible. type public_id | plink.exe "umask 077 test -d. Using the putty tools a command like this should be equivalent (not tested). If you ignore all the parameter handling, error handling, and so on, these are the two commands from ssh-copy-id that are actually doing the work most of the time. Ssh-copy-id is a pretty simple script that should be pretty easy to replicate under windows.
0 Comments
Leave a Reply. |