![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell脚本部署无密码访问
lyongq04
这个作者很懒,什么都没留下…
展开
-
expect执行ssh-keygen
#!/bin/bashecho "===========genrsa===================="expect原创 2016-05-10 17:47:15 · 642 阅读 · 0 评论 -
expect执行ssh-copy-id
#!/bin/baship=$1uname=$2password=$3filepath=/usr/$uname/.ssh/id_rsa.pubif [ $uname = "root" ];thenfilepath=/root/.ssh/id_rsa.pubfiecho "===========resrsa===================="expect...原创 2016-05-10 17:47:36 · 257 阅读 · 0 评论 -
shell新增用户
#!/bin/bashgname=$1uname=$2password=$3echo "==========$gname,$uname,$password======"#userdel $unameisUserExist=` cat /etc/passwd|grep $uname|wc -l `isGroupExist=` cat /etc/group|grep $gn...原创 2016-05-10 17:49:17 · 227 阅读 · 0 评论 -
sed给行前面加入‘#’号
#!/bin/bashfilename=$1key=$2#sed -i '2,5s/'"$key"'.*/#/' $filenamesed -i 's/^'"$key"'/#&/' $filename原创 2016-05-10 18:00:21 · 2678 阅读 · 0 评论 -
sshd_config无密访问的处理
#!/bin/baship=$1currpath=$2hostip=$3 //本机ipif [ -z "$hostip" ] || [ "$ip" != "$hostip" ];thenssh ${ip} $currpath/base/annotationCol.sh "/etc/ssh/sshd_config" "AuthorizedKeysFile\ " ssh ${i...原创 2016-05-10 18:04:28 · 294 阅读 · 0 评论 -
shell脚本部署无密码访问
为了实现一些组件的自动化部署,可能要设置服务器的免密访问比较方便,最后实现了自动化部署密码脚本,以下为实现代码逻辑。代码比较庞大,不能一一道出了。#!/bin/baships=( '10.100.112.79' '10.100.112.203' '10.100.112.204' '10.100.112.205' '10.100.112.95' '10.100.112.125' ) //...原创 2016-05-11 22:56:54 · 167 阅读 · 0 评论