xeruf Asked: 2021-12-11 13:29:55 +0800 CST2021-12-11 13:29:55 +0800 CST 2021-12-11 13:29:55 +0800 CST ssh-copy-id 可以尊重我的 ssh 配置吗? 772 我将所有密钥存储在外部,.ssh并配置了哪个密钥用于我的.ssh/config. 我怎么能ssh-copy-id尊重它? ssh scripting 2 个回答 Voted Best Answer xeruf 2021-12-11T14:16:46+08:002021-12-11T14:16:46+08:00 除非有人想出一些未知的标志,否则我将使用一个简单的包装器: sshci() { ssh-copy-id -i "$(ssh -G "$1" | grep "^identityfile " | head -1 | cut -d " " -f2- | sed "s|^~|$HOME|")" "$1" } https://stackoverflow.com/questions/38304271/bash-extract-user-for-a-particular-host-from-ssh-config-file对创建这个有很大帮助:) Ouss 2022-04-07T04:57:34+08:002022-04-07T04:57:34+08:00 你可以试试: ssh-copy-id -i {{the key you want to copy}} {{the Host config name in ~/.ssh/config file}}
除非有人想出一些未知的标志,否则我将使用一个简单的包装器:
https://stackoverflow.com/questions/38304271/bash-extract-user-for-a-particular-host-from-ssh-config-file对创建这个有很大帮助:)
你可以试试: