0
点赞
收藏
分享

微信扫一扫

windows/linux 免密远程登录Linux

搬砖的小木匠 2022-02-08 阅读 69

本地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"      
    }
}
举报

相关推荐

0 条评论