Re: How to do two or more rsyncs with one password?

2010-08-16 Thread joe

On 08/15/2010 01:23 PM, j...@actionline.com wrote:
How can one do two or more rsyncs with entering the password just once?

Brian Cluff replied:
 ... do it with just one rsync call:

 rsync -avHp --progress subdir1 subdir2 subdir3
 webh...@box000.bluehost.com:www/

Thanks Brian. That is exactly what I was looking for.

 ... if you need to copy into several different destination
 directories, set up a shared key for ssh and copy the public key
 over to the destinations authorized_keys file.

That is also a very helpful suggestion (others have recommended),
but just haven't got it done yet.



---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


Re: How to do two or more rsyncs with one password?

2010-08-16 Thread joe

Kevin Fries wrote:
 A bit snotty for someone asking for help!

Please accept my apology.





---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


Re: How to do two or more rsyncs with one password?

2010-08-16 Thread joe

 http://www.allowe.com/images/DemotivationalPosters/Demotivation09.jpg

Fantastic!



---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


Re: How to do two or more rsyncs with one password?

2010-08-16 Thread keith smith

Hi Joe,

Here is a shell script I inherited.  Probably someone before me found it on a 
website for all I know.  I do not fully understand it however just modify the 
rsync= line, modify the paths= area, and replace ServerNameGoesHere with the 
destination server.  You may want to remove the MySql part.

I'm guessing this works because there is a key in place already.


#!/bin/bash

# sync content to off-site systems

[ -t 1 ]  v=vP
rsync=( rsync -az$v -e ssh -p 22 --bwlimit=2000 --delete-after )

paths=(
    /home   # main thing to get sync'd
    /etc/php.ini    # what if php.d is out of sync?
#   /etc/php.d  # sync via yum somehow?
#   /var/lib/mysql  # use replication instead
    /var/www/html   # nothing here usually
    /var/www/cgi-*  # cgiwrap and phpwrap
#   /var/lib/php/session    # sessions will break anyway
)

for path in ${pat...@]}
do
    [ -t 1 ]  echo $path
    ${rsy...@]} $path ServerNameGoesHere:${path%/*}/  [ -t 1 ]  
wait
done

# sync mysql to a backup folder (replication normally handles it)
[ -t 1 ]  echo /var/lib/mysql
${rsy...@]} /var/lib/mysql/ ServerNameGoesHere:/var/lib/mysql-rsync/

wait
[ -t 1 ] ||
while pgrep -x rsync /dev/null
do
  echo rsync still running!
  sleep 10
done









Keith Smith

--- On Mon, 8/16/10, j...@actionline.com j...@actionline.com wrote:

From: j...@actionline.com j...@actionline.com
Subject: Re: How to do two or more rsyncs with one password?
To: Main PLUG discussion list plug-discuss@lists.plug.phoenix.az.us
Date: Monday, August 16, 2010, 8:19 AM


On 08/15/2010 01:23 PM, j...@actionline.com wrote:
How can one do two or more rsyncs with entering the password just once?

Brian Cluff replied:
 ... do it with just one rsync call:

 rsync -avHp --progress subdir1 subdir2 subdir3
 webh...@box000.bluehost.com:www/

Thanks Brian. That is exactly what I was looking for.

 ... if you need to copy into several different destination
 directories, set up a shared key for ssh and copy the public key
 over to the destinations authorized_keys file.

That is also a very helpful suggestion (others have recommended),
but just haven't got it done yet.



---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss



  ---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Kevin Fries
My preference is to NEVER rsync across an un secured channel.  Rsync is
easily tunneled inside ssh, and ssh can use rsa encryption keys for
authentication.   Solving both problems with one solution.

HTH
Kevin

On Aug 15, 2010 2:23 PM, j...@actionline.com wrote:


How can one do two or more rsyncs with entering the password just once?

I've set up a script that I named copy2blue to copy three specified
subdirectories to my web hosted space, and it works fine, except it
asks me to enter the password for each 'rsync' command.

How can I modify this so it will only ask for the password once?

cd /dir/subdir1
rsync -avHp --progress subdir1 webh...@box000.bluehost.com:www/subdir1/

cd /dir/subdir2
rsync -avHp --progress subdir2 webh...@box000.bluehost.com:www/subdir2/

cd /dir/subdir3
rsync -avHp --progress subdir3 webh...@box000.bluehost.com:www/subdir3/



---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Re: How to do two or more rsyncs with one password?

2010-08-15 Thread joe

Kevin wrote:
 My preference is to NEVER rsync across an un secured channel.
 Rsync is easily tunneled inside ssh, and ssh can use rsa encryption
 keys for authentication.   Solving both problems with one solution.
 HTH

Thanks for your opinion ... although what you wrote does not provide
any practical guidance for how to invoke what you recommend doing ...
so your good wishes HTH doesn't H much. ;)



---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Brian Cluff

My first thought is, why aren't you doing it with just one rsync call like:

rsync -avHp --progress subdir1 subdir2 subdir3 
webh...@box000.bluehost.com:www/


If it's because your example doesn't directly reflect your situation, as 
in your are needing to copy into several different destination 
directories, you will just need to setup a shared key for ssh and copy 
the public key over to the destinations authorized_keys file.  Once you 
have done that, you can copy over to the destination without any 
passwords at all if you want.


Brian Cluff

On 08/15/2010 01:23 PM, j...@actionline.com wrote:


How can one do two or more rsyncs with entering the password just once?

I've set up a script that I named copy2blue to copy three specified
subdirectories to my web hosted space, and it works fine, except it
asks me to enter the password for each 'rsync' command.

How can I modify this so it will only ask for the password once?

cd /dir/subdir1
rsync -avHp --progress subdir1 webh...@box000.bluehost.com:www/subdir1/

cd /dir/subdir2
rsync -avHp --progress subdir2 webh...@box000.bluehost.com:www/subdir2/

cd /dir/subdir3
rsync -avHp --progress subdir3 webh...@box000.bluehost.com:www/subdir3/

---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Lisa Kachold
Hey Joe!

On Sun, Aug 15, 2010 at 1:23 PM, j...@actionline.com wrote:


 How can one do two or more rsyncs with entering the password just once?

 I've set up a script that I named copy2blue to copy three specified
 subdirectories to my web hosted space, and it works fine, except it
 asks me to enter the password for each 'rsync' command.

 How can I modify this so it will only ask for the password once?

 cd /dir/subdir1
 rsync -avHp --progress subdir1 webh...@box000.bluehost.com:www/subdir1/

 cd /dir/subdir2
 rsync -avHp --progress subdir2 webh...@box000.bluehost.com:www/subdir2/

 cd /dir/subdir3
 rsync -avHp --progress subdir3 webh...@box000.bluehost.com:www/subdir3/

 I agree with Kevin in this.
User keys are the best solution.

However, in PCI Compliance, SSH, (even via keys) are often not allowed as
the root user, depending on your switch/firewall and VLAN settings.

I am assuming you are not worried about that (just setup SSH keys and run
your command and you will not be prompted for the passwords):

http://troy.jdmz.net/rsync/index.html

You could also only allow forced commands in SSH via the key (for security):
PermitRootLogin forced-commands-only (explained in the Link)


Where root SSH key exchange is not possible, you could alternately add
expect (outside a production controlled SRC environment) and script in a
challenge and password to your backup script.

http://www.sitepoint.com/blogs/2004/09/01/backing-up-using-expect-and-rsync/


-- 
Office: (602)239-3392
ATT: (503)754-4452
http://it-clowns.com http://it-clowns.com/wiki/index.php?title=Obnosis
Faith is, at one and the same time, absolutely necessary and altogether
impossible. 
--Stanislav Lem
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Kevin Fries
A bit snotty for someone asking for help!

Set up ssh-server on each of your target machines.  Once key authentication
is set up, I generally turn off password authentication, but that is just my
paranoia.  Man for sah-keygen, the how to is right there.  Then man rsync
and the switches to tunnel via ssh are right there.

All this was right in your documentation of what I said in my original
post.  I assumed you were looking to learn.  If not, you may want to
consider a consultant if you just want someone to do it for you.

The H was there if only you looked for it.

Kevin

On Aug 15, 2010 2:42 PM, j...@actionline.com wrote:

Kevin wrote:  My preference is to NEVER rsync across an un secured channel.
 Rsync is easily tunn...
Thanks for your opinion ... although what you wrote does not provide
any practical guidance for how to invoke what you recommend doing ...
so your good wishes HTH doesn't H much. ;)

--- PLUG-discuss mailing
list - plug-disc...@list...
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Lisa Kachold
Kevin,

Shine it on!

http://www.obnosis.com/motivatebytruth/beprepared.jpg

On Sun, Aug 15, 2010 at 1:52 PM, Kevin Fries kfri...@gmail.com wrote:

 A bit snotty for someone asking for help!

 Set up ssh-server on each of your target machines.  Once key authentication
 is set up, I generally turn off password authentication, but that is just my
 paranoia.  Man for sah-keygen, the how to is right there.  Then man rsync
 and the switches to tunnel via ssh are right there.

 All this was right in your documentation of what I said in my original
 post.  I assumed you were looking to learn.  If not, you may want to
 consider a consultant if you just want someone to do it for you.

 The H was there if only you looked for it.

 Kevin

 On Aug 15, 2010 2:42 PM, j...@actionline.com wrote:

 Kevin wrote:  My preference is to NEVER rsync across an un secured
 channel.  Rsync is easily tunn...
 Thanks for your opinion ... although what you wrote does not provide
 any practical guidance for how to invoke what you recommend doing ...
 so your good wishes HTH doesn't H much. ;)

 --- PLUG-discuss mailing
 list - plug-disc...@list...


 ---
 PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
 To subscribe, unsubscribe, or to change your mail settings:
 http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss




-- 
Office: (602)239-3392
ATT: (503)754-4452
http://it-clowns.com http://it-clowns.com/wiki/index.php?title=Obnosis
Faith is, at one and the same time, absolutely necessary and altogether
impossible. 
--Stanislav Lem
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Kevin Fries
Sorry about getting a bit snotty myself.  But the OP isn't doing the work to
solve and learn himself, he just wanted someone to do his job for him. Had I
been home I would have googled the answer and posted a link, but I am
replying from my phone, trying to help someone too lazy to help themselves.

Kevin

On Aug 15, 2010 2:57 PM, Lisa Kachold lisakach...@obnosis.com wrote:

Kevin,

Shine it on!

http://www.obnosis.com/motivatebytruth/beprepared.jpg

On Sun, Aug 15, 2010 at 1:52 PM, Kevin Fries kfri...@gmail.com wrote:

   A bit snotty for someone asking for help!   Set up ssh-server on each
 of your target machines

  ---  PLUG-discuss
 mailing list - plug-disc...@lis...



-- Office: (602)239-3392 ATT: (503)754-4452 http://it-clowns.com Faith is,
at one and the same ...

---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Brian Cluff

On 08/15/2010 01:52 PM, Kevin Fries wrote:
 A bit snotty for someone asking for help!

Lets not go there, encryption can be a difficult concept for those that 
haven't ever touched it.  I think we tend to forget how some of these 
things come very easy to us and what we perceive as a push in the right 
direction is no more than a bunch of computer jargon they have never 
heard before.



Set up ssh-server on each of your target machines.  Once key
authentication is set up, I generally turn off password authentication,
but that is just my paranoia.  Man for sah-keygen, the how to is right
there.


There is a typo in his explanation, he means ssh-keygen
In a nutshell, you just run the program following the directions given 
and then copy the contents of id_rsa.pub file that it will create to the 
next line of the .ssh/authorized_keys file in the home directory of the 
destination machine.  You will probably have to create the file if keys 
have never been used on the system.



Then man rsync and the switches to tunnel via ssh are right there.


This should be unnecessary as rsync uses ssh by default these days, and 
has for years.


Brian Cluff
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


Re: How to do two or more rsyncs with one password?

2010-08-15 Thread Lisa Kachold
http://www.allowe.com/images/DemotivationalPosters/Demotivation09.jpg

On Sun, Aug 15, 2010 at 2:03 PM, Kevin Fries kfri...@gmail.com wrote:

 Sorry about getting a bit snotty myself.  But the OP isn't doing the work
 to solve and learn himself, he just wanted someone to do his job for him.
 Had I been home I would have googled the answer and posted a link, but I am
 replying from my phone, trying to help someone too lazy to help themselves.

 Kevin

 On Aug 15, 2010 2:57 PM, Lisa Kachold lisakach...@obnosis.com wrote:

 Kevin,

 Shine it on!

 http://www.obnosis.com/motivatebytruth/beprepared.jpg

 On Sun, Aug 15, 2010 at 1:52 PM, Kevin Fries kfri...@gmail.com wrote:

   A bit snotty for someone asking for help!   Set up ssh-server on
 each of your target machines

  ---  PLUG-discuss
 mailing list - plug-disc...@lis...



 -- Office: (602)239-3392 ATT: (503)754-4452 http://it-clowns.com Faith
 is, at one and the same ...

 ---
 PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
 To subscribe, unsubscribe, or to change your mail settings:
 http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


 ---
 PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
 To subscribe, unsubscribe, or to change your mail settings:
 http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss




-- 
Office: (602)239-3392
ATT: (503)754-4452
http://it-clowns.com http://it-clowns.com/wiki/index.php?title=Obnosis
Faith is, at one and the same time, absolutely necessary and altogether
impossible. 
--Stanislav Lem
---
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss