Tag Archives: pssh

sudo 与重定向符号共用时出现permission denied的处理方案

由于之前在云厂商工作的关系,对于一次性批量操作不是很喜欢使用 ansible或者saltstack操作,而是爱用效率比较高的pssh。 当然,pssh所带来的弊端更多的会局限在sudo上,尤其是带密码的私钥和在使用重定向符号的时候报permission denied的情况,这次我们只share一下关于使用重定向符号return permission denied的解决方案。 # ssh [email protected] -x ‘sudo echo ” */5 * * * * user /bin/bash /opt/auto/testing” >> /etc/crontab’ bash: /etc/crontab: Permission denied 其实最简单的办法就是使用bash -c “” 将要sudo的命令包起来(注意,需要对引号进行转义): ssh [email protected] -x ‘sudo sh -c “echo \” */5 … Continue reading

Posted in AutomaticOPS, Linux, OS, SSH/PSSH | Tagged , , , , | Leave a comment

pssh使用带有密码的私钥登陆在使用-A参数之后报错

pssh使用带有密码的私钥登陆在使用-A参数之后报“tderr: Enter passphrase for key ‘****” 解决方法: 修改 vim /lib/python2.7/site-packages/psshlib/askpass_client.py OS X为:  vim /usr/local/Cellar/pssh/2.3.1/lib/python2.7/site-packages/psshlib/askpass_client.py 将第67行的: if not prompt.strip().lower().endswith(‘password:’): 改为 if not ( prompt.strip().lower().endswith(‘password:’) or ‘enter passphrase for key’ in prompt.strip().lower()):

Posted in AutomaticOPS, Linux, SSH/PSSH | Tagged , | Leave a comment