Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-25-2010, 11:43 AM
|
#1
|
Member
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332
Rep:
|
rsync over ssh: authentication by cryptographic key
I have 2 boxes, both using Slackware64 ver. 13.
Box1 - ssh server and rsync server daemon are functional.
Box2 - client box that connects to Box1 by ssh as well as rsync by way of ssh.
I followed the instructions in Chapter 2 of the O'Reilly book "The Secure Shell, The Definitive Guide" to setup ssh authentication by pub/private keys.
The configuration works, but only once, and upon re-logging into Box2, I find I have to go through the following setup to make it work again -
$ssh-agent $SHELL
$ssh-add /home/mike/.ssh/id_rsa
then prompted to provide passphrase.
Then rsync over ssh will work - example:
rsync -e "ssh -p 45000" -avzi mike@10.10.10.100:/zzz /mnt/current
I want to get it configured so that it works every time with no user input, in order to configure automatic cronjobs using rsync commands like the one above.
Thanks for your help.
Last edited by Sum1; 06-25-2010 at 11:44 AM.
|
|
|
06-25-2010, 12:00 PM
|
#2
|
Member
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548
Rep:
|
|
|
|
06-25-2010, 12:30 PM
|
#3
|
Member
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332
Original Poster
Rep:
|
Thanks Mpapet, I'll give it a try over lunch. :-)
|
|
|
06-25-2010, 01:30 PM
|
#4
|
Member
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332
Original Poster
Rep:
|
I completed the instructions according to the linked web-page and it works perfectly when I am logged in as the user; however, it does not work when logged in as root. When I execute the rsync-via-ssh bash script, I get prompted for a password.
I think I've found a new issue that requires a new question --
Is it possible to run a particular cronjob as a user?
I believe when I put the rsync bash script in as a cronjob, it is executed by the root account, and will fail to complete just like it did when I try manually while logged in as root.
Is this the correct way to state a user-specified cronjob? -
15 * * * * mike /home/mike/my_rsync_bash_script >> /dev/null 2>&1
Thanks for your time and help.
Very much appreciated.
|
|
|
06-25-2010, 01:40 PM
|
#5
|
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Rep: 
|
Quote:
Originally Posted by Sum1
I completed the instructions according to the linked web-page and it works perfectly when I am logged in as the user; however, it does not work when logged in as root. When I execute the rsync-via-ssh bash script, I get prompted for a password.
|
If you generate a keypair for one user, the private key is generally available to that user and no one else. For this authentication scheme to behave otherwise would be a major security problem.
Just run through the same key generation steps (and the steps that follow) for root, and you should be in business.
Last edited by anomie; 06-25-2010 at 01:42 PM.
|
|
|
06-25-2010, 02:38 PM
|
#6
|
Member
Registered: Jul 2007
Distribution: Fedora, CentOS, and would like to get back to Gentoo
Posts: 332
Original Poster
Rep:
|
Quote:
Originally Posted by anomie
Just run through the same key generation steps (and the steps that follow) for root, and you should be in business.
|
Right you are; right you are, indeed. :-)
Thanks to you too, Anomie.
|
|
|
All times are GMT -5. The time now is 04:22 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|