I need to write a script that runs several tasks against a remote server via SSH & rsync. To be keep it simple, imagine just an rsync followed by a command via SSH.
I don't want this to be passwordless - I want the script to require the remote password before it runs. But I don't want to have to enter it again until the script ends.
Is there a good way to do this?
On Mon, Dec 17, 2018 at 10:42:23AM +0000, Mark Rogers wrote:
I need to write a script that runs several tasks against a remote server via SSH & rsync. To be keep it simple, imagine just an rsync followed by a command via SSH.
I don't want this to be passwordless - I want the script to require the remote password before it runs. But I don't want to have to enter it again until the script ends.
Is there a good way to do this?
Yes, use ssh's 'ControlMaster' and related commands. Then do something like my script below:-
#!/bin/bash # # # Get new pictures from camera, send to esprimo, import into Digikam and update sigal # ssh -fN esprimo # # # copy the files from the camera # echo -e "\nCopying files from camera" rsync -a /media/chris/6465-3837/DCIM/*PANA/* esprimo:dld/tz60/ # # # run picImport.py on esprimo to copy the files into ~/pictures # echo -e "\nRunning picImport.py" ssh esprimo /home/chris/bin/picimport.py -s /home/chris/dld/tz60 # # # run sigal on esprimo # echo -e "\nRunning sigal" ssh esprimo /usr/local/bin/sigal build -c /home/chris/bin/sigal.conf.py # # # copy sigal files back to t470 # echo -e "\nCopying sigal files back to t470" rsync -a esprimo:/srv/sigal/ /srv/sigal/
This only asks for the password once and leaves the initial ssh running in the background so all the other rsync/ssh commands use the connection set up by that initial ssh. It uses the 'ControlMaster' setting because my ~/.ssh/config file has:-
ControlMaster auto ControlPath ~/.ssh/%r@%h:%p
You can of course do this bit from the command line oif you want.
On Mon, 17 Dec 2018 at 10:51, Chris Green cl@isbd.net wrote:
Yes, use ssh's 'ControlMaster' and related commands. Then do something like my script below:-
Perfect! Thank you (and for the example I snipped).
Can any of you recommend a supplier of a decent PC to replace my rather sad 4Gb Core Duo machine with something a bit more modern? It *must* run Linux. And I'd like some better graphics (having recently had a play with a 5K Retina iMac, I'd like something comparable - I'd have kept the Mac, but macOS drives me bonkers). Apart from that, I'm flexible; perhaps a quad core i5, 16Gb memory, happy to be persuaded into an SSD (possibly just for the O/S) and Tb disk for everything else.
No Gigabyte mobos, please. I've just had a hideous time with my wife's old machine which has one (and was supplied by Novatech, who are tainted as a result). And nothing made by Samdung (sic), I won't buy anything made by them. What's Dell's stuff like these days? This machine is an Inspiron 530 which has been great, it's just getting on a bit and stuff like GIMP, transcoding audio and video and general waiting for windows to open & programs to start is becoming wearisome. I don't play games.
Happy New Year,
Huge.
On Thu, 27 Dec 2018 10:49:10 +0000 Huge huge@huge.org.uk allegedly wrote:
Can any of you recommend a supplier of a decent PC to replace my rather sad 4Gb Core Duo machine with something a bit more modern? It *must* run Linux. And I'd like some better graphics (having recently had a play with a 5K Retina iMac, I'd like something comparable - I'd have kept the Mac, but macOS drives me bonkers). Apart from that, I'm flexible; perhaps a quad core i5, 16Gb memory, happy to be persuaded into an SSD (possibly just for the O/S) and Tb disk for everything else.
Huge
Try Zoostorm. Ebuyer have them. I bought my wife a laptop (Intel Pentium DC B980 2.4GHz, 8GB RAM, 500GB HDD, 15.6" HD LED, DVDRW) about 5 years ago and it is still going strong and she really likes it. It used to run Ubuntu, but now runs Mint 18.
My main desktop is a Zoostorm with 3.4GHz Intel Core i7-6700, 16GB RAM, MSI MoBo, Intel Graphics, DVDRW. Bought nearly three years ago now, it originally came with a 2TB disk, but I've swapped that out for a 128 GiG SSD for the OS plus a 3TB spinning rust item for data. Like the laptop it came with no OS so I didn't have to pay the Microsoft tax.
Looking at the ebuyer site just now, they have several which might meet your requirements. The KabyLake Core i5 model costs just under £410, but you'd need to add another 8 Gig of RAM and an SSD. The one I'd probably go for would be the KabyLake Intel Core i7-7700 model with 16 Gig already on board. Just add your chosen SSD. That costs a shade under £660.
One point to beware is that the desktops tend to come with rather under specced PSUs. Although I had no trouble with the original 250 watt PSU supplied I swapped mine for a 450 watt unit just to be safe.
Mick
--------------------------------------------------------------------- Mick Morgan gpg fingerprint: FC23 3338 F664 5E66 876B 72C0 0A1F E60B 5BAD D312 https://baldric.net/about-trivia ---------------------------------------------------------------------
On 27/12/2018 10:49, Huge wrote:
Can any of you recommend a supplier of a decent PC to replace my rather
If I'm in a hurry I get my bits, and complete flattops, from Anglian Internet on Rowntree way. Not the cheapest but they've never sold me a duff bit in the last 18 years or so.
They're worth a visit as a face to face chat gets more then they have on their website.
Nev
FWIW, I bought a "refurbished" Dell Optiplex 7050 on eBay (i7 7th Gen, 8GB memory, 1Tb spinning rust) and put a NVMe "disk" in it for "/" and boot device (but not swap). It runs like the wind ...
Not sure I like Mint 19.1 Cinnamon all that much, though. Linux seems to be getting more and more like macOS - a kind-of Unix system hiding behind an impenetrable user interface, with a lot of the nastier UI kinks of Windows.
On Thu, 2018-12-27 at 16:27 +0000, Nev Young wrote:
On 27/12/2018 10:49, Huge wrote:
Can any of you recommend a supplier of a decent PC to replace my rather
If I'm in a hurry I get my bits, and complete flattops, from Anglian Internet on Rowntree way. Not the cheapest but they've never sold me a duff bit in the last 18 years or so.
They're worth a visit as a face to face chat gets more then they have on their website.
Nev
main@lists.alug.org.uk http://www.alug.org.uk/ https://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
On Fri, 2019-01-25 at 12:23 +0000, Huge wrote:
FWIW, I bought a "refurbished" Dell Optiplex 7050 on eBay
I forgot to say, it came sealed in the manufacturers original security packaging and appeared to have never been unpacked internally, so I assume it was a unwanted, unused return. I bought a Dell because (i) my old machine is a Dell and works well, it's just old now & (ii) Dell appear to offer a modicum of Linux support.