Alternative to ssh-copy-id on windows

How to connect with ssh key to Raspberry Pi from a windows machine


            

Lately I am doing a lot of development on Raspberry Pi systems and I use Visual Studio Code Remote Development. This is a neat feature because it allows me to connect from the same platform to multiple systems at once and work in parallel if I need. Visual Studio Code includes a full featured integrated terminal that starts at the root of the workspace. It provides integration with the editor to support features like links and error detection. The integrated terminal can run commands such as mkdirand gitjust like a standalone terminal. I am not getting into more details, here is a link to a page with very detailed information, however, being allowed this kind of integration is very practical and useful for me especially when managing or writing applications directly on a Raspberry Pi.

However, there is a drawback. Using VS Code remotely requires password input for login. When inactive, session expires and you need to reload the VS Code window and enter login credentials again and again. The solution is to use a ssh key login approach which is quite easy to do. A detailed tutorial can be found at this link. However, on windows the ssh-copy-id script does not exist.

There is a very interesting discussion with a lot of information on how to bypass this limitation on this forum thread, but I rather prefer a simple, straightforward approach. It is, thus, easier to copy the public key (for example id_rsa.pub to your remote system (scp or winscp will do) and then run:

cat id_rsa.pub >> .ssh/authorized_keys

This will add the key to the authorized_keys file:

Content of ~/.ssh/authorized_keys on Raspberry Pi


Next time when you will logon from a Windows machine, you will not be prompted for password.

Hope this helps
73

Adalm Pluto ? Don’t think so

I have a love-hate relationship with Adalm Pluto. I bought it from Mouser in 2020 when it was roughly 100 euros (now it is almost double that price !) and I never managed to do anything useful with it.

Using lsof

lsof command can show which processes are using which resources. This is extremely useful for troubleshooting. Basic syntax is: Without arguments, it lists all open files on the system (requires root privileges). Common Use Cases and Examples: Find which process is using a file: Find which process is using a port: The above command Lists […]

Comments are closed.