Re: remote sudo script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 08.Okt.2013, at 04:51, Tim Dunphy wrote:

...

> But more importantly, when I try to pop the above two working statements
> from the command line into a script, the following occurs:
> 
> [tdunphy@MIAGRBISSH01V ~]$ for i in MIAGRBIORCA0{0..9}V MIAGRBIORCA1{0..2}V
>> 
>> do
>> 
>> ssh -q -t -t -t $i sudo -S 'cp -v /data/solr-4.3.1/zoe/etc/logback.xml
> /tmp/logback.xml-${i}-$(date +%Y%m%d).bak' <<EOF
>> secret_sauce
>> EOF
>> 
>> ssh -q -t -t -t $i sudo -S 'ls -l  /home/tdunphy/logback.xml-${i}-$(date
> +%Y%m%d).bak' <<EOF
>> secret_sauce
>> EOF
>> 
>> done


> tcgetattr: Inappropriate ioctl for device
> `/data/solr-4.3.1/zoe/etc/logback.xml' -> `/tmp/logback.xml--20131007.bak'

The cp did work, sudo accepted the password.
Note that ${i} was not interpolated into the file name.

> tcgetattr: Inappropriate ioctl for device
> -rw-r--r-- 1 root root 3372 Oct  7 22:07
> /home/tdunphy/logback.xml--20131007.bak

the ls did work

> tcgetattr: Inappropriate ioctl for device
> [sudo] password for tdunphy:

But what's that?
Is the password the same on all hosts, i.e. it works for one host, but not the other?
Or do you have another ssh in the for loop you did not tell us about?

Try do add some debugging output with the hostname into the loop.

-- 
Markus

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux