Remote commands....

Forgive my expertise in Linux, but is there a way to run a command on another Raspbian card? Suppose I setup a command file on RPi #2, and want to run it from RPi #1. A command like:

tell RPi2 "ntpq -pn"

perhaps with the output coming to my terminal. Of course, I could do this with ssh-ing into RPi-2, but I would like to avoid the ssh step.

Likely it's obvious, but not (yet) to me!

--
Thanks, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor
Loading thread data ...

Well, for that case it is not required because you can do:

ntpq -pn RPi2

When that does not work, go to RPi2 and add in the /etc/ntp.conf:

restrict aa.bb.cc.dd

(the IP address of RPi1) Then restart ntpd (or the entire Pi)

That does not restrict that address, it lifts the restrictions on who can run external queries.

However, when you want to run other commands, you can use ssh:

ssh user@RPi2 command

Reply to
Rob

What is wrong with "ssh RPi2 ntpq -pn"? You need not log in to the remote Pi but can pass a single command to the ssh command. Once you managed to copy your key to the second machine (man ssh-copy-id) you need no password either.

--
Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de 
HTML mails will be forwarded to /dev/null.
Reply to
Peter Heitzer

indeed, you were so close!

ssh user@RPi2 "ntpq -pn"

password can be avoided by using public key based authenticaqtion, if that fits with your security model

--
umop apisdn
Reply to
Jasen Betts

Thanks, Rob, Peter & Jasen. You've just saved me quite a lot of effort.

Rob, yes, ntpq was a poor choice of command! It's actually an automated ntp update which I run as "./update-ntp"

Peter, thanks for the pointer to ssh-copy-id. Worthy of further investigation.

Jasen, thanks for the information.

I can confirm that what you have all suggested works perfectly for me.

--
Thanks, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.