1 Star 2 Fork 1

yanjh/ShellScripts

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ssh_trust.sh 426 Bytes
一键复制 编辑 原始数据 按行查看 历史
yanjh 提交于 2023-04-13 16:45 +08:00 . without code;ssh trust
#!/bin/bash
usage() {
echo "Usage: $0 hostname"
}
if [ $UID -ne 0 ]; then
echo -e "Permission Denied"
exit 1
fi
if [ ! -f /root/.ssh/id_rsa ];then
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa -q
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
fi
hostname=$1
if [[ $# -eq 1 ]] && [[ "$hostname" != "" ]];then
ssh-copy-id -i ~/.ssh/id_rsa.pub $hostname
else
echo "Error: Missing required arguments."
usage
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/CloudBot/ShellScripts.git
git@gitee.com:CloudBot/ShellScripts.git
CloudBot
ShellScripts
ShellScripts
master

搜索帮助