修改/etc/ssh/ssh_config
vim /etc/ssh/ssh_config
将# StrictHostKeyChecking ask
改为StrictHostKeyChecking no
这样ssh第一次连接不会询问
/etc/init.d/reboot.sh
#!/bin/sh
source /etc/profile
echo "start"
TIME=`cat /proc/uptime |cut -d. -f1`
# 注意这里是秒为单位 太长时间会被kill掉 60左右吧
while (($TIME<30))
do
echo "开始任务..."
cat /root/.ssh/id_rsa.pub > /root/.ssh/known_hosts
/usr/bin/ssh root@localhost -D 0.0.0.0:8808 -fN
echo "当前开机时间${TIME}"
sleep 3s
TIME=`cat /proc/uptime |cut -d. -f1`
done
然后其它开机设置参考
https://www.jianshu.com/p/bd56b169252d
最后面的
网友评论