Linux下,.sh命令运行时需要密码 解决

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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值