码迷,mamicode.com
首页 > 其他好文 > 详细

批量添加公钥给server的bash

时间:2018-04-27 15:43:08      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:dir   aaa   公钥   monitor   color   col   span   mod   add   

Bash 脚本

#/bin/bash
adduser vlmonitor
mkdir -p /home/vlmonitor/.ssh
chown -R vlmonitor.vlmonitor /home/vlmonitor/.ssh/
chmod -R 700 /home/vlmonitor/.ssh/
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD5eLJ917WlMCA+EpOESXmCOv1v6+2uMSgT6q/3WSfARUwEsWisKdPGOGYCZgeHA/i3yoLha5ei0AAAAB3NzaC1yc2EAAAADAQABAAABAQD5eLJ917WlMCA+EpOESXmCOv1v6+2uMSgT6q/3WSfARUwEsWisKdPGOGYCZgeHA/i3yoLha5ei0LAAAAB3NzaC1yc2EAAAADAQABAAABAQD5eLJ917WlMCA+EpOESXmCOv1v6+2uMSgT6q/3WSfARUwEsWisKdPGOGYCZgeHA/i3yoLha5ei0 vlmonitor@ip-10-10-1-35" > /home/vlmonitor/.ssh/authorized_keys
chown -R vlmonitor.vlmonitor /home/vlmonitor/.ssh/authorized_keys
chmod 600 /home/vlmonitor/.ssh/authorized_keys

注意:采用公私钥的方式登陆ssh的方法,对配置文件和目录的权限及其敏感,700,600的问题要搞清楚

批量添加公钥给server的bash

标签:dir   aaa   公钥   monitor   color   col   span   mod   add   

原文地址:https://www.cnblogs.com/oskb/p/8962404.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!