本地Linux:https://jingyan.baidu.com/article/c275f6ba08267ae33c756758.html
本地windows:win10 ssh 上传密钥过程,出现 无法将“ssh-copy-id”项识别_Defiler_Lee的博客-CSDN博客
function ssh-copy-id([string]$userAtMachine, $args){
$publicKey = "$ENV:USERPROFILE" + "/.ssh/id_rsa.pub"
if (!(Test-Path "$publicKey")){
Write-Error "ERROR: failed to open ID file '$publicKey': No such file"
}
else {
& cat "$publicKey" | ssh $args $userAtMachine "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys || exit 1"
}
}