Windows 10 missing ssh-copy-id

Microsoft is finally shipping Windows with SSH. On my Windows 10 machine, it’s OpenSSH:

PS C:\Users\Kasper> ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

Somehow they missed to get the ssh-copy-id tool implemented, so we need to find another way of copying our ssh keys. Thankfully it’s not that complicated, we can use powershell (probably even cmd)

cat .\.ssh\id_rsa.pub | ssh -l username ssh_server "cat >> .ssh/authorized_keys"

This will concatenate (cat) your ssh key to the authorized_keys file on your ssh_server.

I’m using cat, to make it easy for Linux/unix admins, type, and get-content will also do, as both cat and type are aliases for get-content. I assume “type” will be available in cmd.exe

Ping not permitted in WSL

Using Windows subsystem for Linux (WSL) is so nice, when you are forced to work from an inferior OS, sometimes also referred to as “a gaming console”
Especially combined with the Windows Terminal, which I wrote about here: https://www.nordal-lund.dk/?p=592 I’m sure that most Linux/Unix administrators will feel right at home.

Despite all the goodness, there are some minor annoyances preventing me from experiencing a big burst of happiness. One of them are the inability to use ping on a std. WSL Debian as a non-root user. That’s right, you need to do “sudo ping nice.little.address” or you will be denied šŸ™

The root cause is the ping utility missing the SUID bit, which it has on the real distro. Luckily there’s an easy fix, add the SUID bit to the ping utility:

sudo chmod u+s /bin/ping

Thats it, now you can ping without sudo again šŸ™‚

Happy pinging
/Kasper

Finally a decent terminal for Windows

Tip! Check out my new post about making the terminal great again here

For years and years Windows users have had to work with disabled tools when trying to work in the command line interface. The old cmd had a bad interface, and even powershell until very recent, has also been a pain. One of the most annoying things has been the missing ability to adjust the window size to your needs, furthermore tab completion has either been missing or bad implemented. All in all, flexibility has not been a keyword for any of the old terminals, but this is all in the past, because now we have Windows terminal!

Easy to install from the Windows store or with command line package manager like chocolatey, and has a great deal of the features you know from various Linux terminals.

Windows terminal supports multiple terminals in tabs, split panes horizontal and vertical, custom background and a lot more. Check it out here: https://github.com/microsoft/terminal

If you are a Linux user and sometimes have to work from Windows, Windows terminal also work perfect with WSL (Windows Subsystem for Linux). Install the terminal, install your favorite Linux, and you are good to go. Here are some small tips to make the experience even better:

  1. Make Linux the default shell by editing the json settings file. You find it by clicking the small “down-arrow” and select settings. Add the guid number of the Linux you want to start to the defaultprofile setting.
  2. Make the Linux shell start in the Linux home folder by adding this setting to the bottom of the paragraph of your Linux profile:
    “commandline”: “wsl.exe ~”

If you are interested in command line stuff, and working on Windows, this is a nice resource to follow: https://devblogs.microsoft.com/commandline/