📜  将authorized_keys中的条目从windows添加到linux主机-Shell-Bash代码示例

📅  最后修改于: 2022-03-11 14:51:05.406000             🧑  作者: Mango

代码示例1
$USER_AT_HOST="your-user-name-on-host@hostname"
$PUBKEYPATH="$HOME\.ssh\id_rsa.pub"

$pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh "$USER_AT_HOST" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"