The Windows version of OpenSSH client doesn't include a ssh-copy-id command. I don't know why. If it does one day, then this can be ignored.
NOTE If you have Windows Subsystem for Linux (WSL) installed, you can use the linux version of ssh-copy-id instead. Go to the description at the end of this document.
- Download the file
ssh-copy-id.cmd
to your Windows PC, or copy and paste its contents. - Run the script passing your linux ssh information (for example
ssh-copy-id.cmd [email protected]
). This should work with any Linux platform. Alternatively, if you have experience, you can use the powershell version.ssh-copy-id.ps1
. Run the script aspowershell .\ssh-copy-id.ps1 [email protected]
. - Run the command for each linux account you connect with. You will be prompted for your Linux host password. If you have more than 1 account on any machine, you must do this for each account.
The file name and location of the script is not important but the filename extension must be .cmd
If the public key is already known to the account, it will not be added again.
- You have installed Microsoft's version of OpenSSH Client on your machine. Read this. You do NOT need to install SSH Server. Current versions of Windows 10 and Windows 11 have OpenSSH installed as part of the base Operating System and you do NOT need to install it.
- You have generated a default authorize key. DO THIS ONLY ONCE.
You can tell if this is done by looking in your
.ssh
folder. From command line typedir %userprofile%\.ssh\id_rsa.*
If you find 2 files,id_rsa and id_rsa.pub,
your default keys have been generated. Otherwise, runssh-keygen
Press enter for all prompts and the default keys will be generated in the correct place.ssh-keygen
will warn you it is about to override exiting keys. If it does warn, answer no.
If you have Windows Subsystem for Linux (WSL) installed you can use the linux version of ssh-copy-id. The command prompt version:
pushd %USERPROFILE%\.ssh & wsl ssh-copy-id -i id_rsa -F config <ssh info> & popd
The PowerShell version:
pushd $env:USERPROFILE\.ssh ; wsl ssh-copy-id -i id_rsa -F config <ssh info> ; popd