Linux下,.sh命令运行时需要密码 解决
Linux下,运行.sh命令clearDB.sh,需要输入密码。这样不好,会导致bat操作被block住。上网Google,关键字:Linux ssh 免密码参考文章链接:http://www.diybl.com/course/6_system/linux/Linuxjs/20081010/149793.htmlhttp://technic.txwm.com/linux/v43331.vh...
Linux下,运行.sh命令clearDB.sh,需要输入密码。
这样不好,会导致bat操作被block住。
上网Google,关键字:Linux ssh 免密码
参考文章链接:
http://www.diybl.com/course/6_system/linux/Linuxjs/20081010/149793.html
http://technic.txwm.com/linux/v43331.vhtml
尝试如下操作:
[root@dcm-linux-01 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
c1:bd:9a:ed:e5:1f:6c:ba:61:d2:be:25:bd:77:f9:a0 root@dcm-linux-01
[root@dcm-linux-01 ~]# cd .ssh
[root@dcm-linux-01 .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
[root@dcm-linux-01 .ssh]# cat id_rsa.pub >> authorized_keys
测试结果:OK!
(再运行sh文件时,不再需要输入密码了)
说明:此处为了简单起见,将passphrase设置为空
主要步骤:
生成公钥id_rsa.pub和私钥id_rsa(覆盖原先的公私钥);
将公钥文件的内容追加到authorized_keys文件中去。
自己动手,丰衣足食!
20091013追加->
今天下午,在dcm-linux-02、dcm-suse-01、dcm-suse-02这3台机器上,都遇到了这个需要输入密码的问题,根据以前写的这个操作提示,立马搞定!~
更多推荐
所有评论(0)