LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-03-2009, 08:56 PM   #1
MJBoa
LQ Newbie
 
Registered: May 2008
Posts: 15

Rep: Reputation: 0
Sudoers and rsync over ssh help


Hi guys. So here's my situation. I have a server I'm about to wipe and rebuild. I have a backup at a remote location but I want the files locally so I can fool around with them and pick and choose what i want on the server. So I want to rsync certain directories over ssh.
Here's what I'm doing.
My rsync command:
rsync -avz -e "ssh -p 22" mjboa@site:/etc/ /home/mike/Documents/Projects/site_backup_12_3_09/etc/ --rsync-path="sudo rsync"

This worked on a different directory so I know I have the basics down.
The confusing part is that I need root access on the remote machine to read /etc but I don't want to PermitRootLogin on sshd.
So I read somewhere that I can set it so that I don't need to enter a password for sudo with just rsync and I can set the command rsync runs on the remote machine. Makes perfect sense.

So I have my sudoers on the remote machine:
mjboa ALL=PASSWD: ALL, NOPASSWD:/usr/bin/rsync

I see nothing wrong with this, even through the screwed syntax of sudoers, and I've had trouble with sudoers before.

What I get out of this is when i log in as mjboa on my server, I don't get prompted for a password at all, for any command.
And when I run the rsync command, it actually prompts me for a password! And it displays it in plain text and does nothing when I enter it.
What the hell is going on? Someone has to have done this successfully before.

Thanks.
 
Old 12-04-2009, 05:26 PM   #2
Cocoabean
LQ Newbie
 
Registered: Jan 2007
Distribution: Ubuntu
Posts: 17

Rep: Reputation: 0
Save yourself the headache and just rsync the other way.



ssh mjboa@site
sudo rsync -avz /etc/ localusername@localworkstation:/home/mike/Documents/Projects/site_backup_12_3_09/etc/
 
Old 10-05-2010, 07:46 PM   #3
kettlewell
LQ Newbie
 
Registered: Oct 2010
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by MJBoa View Post
Hi guys. So here's my situation. I have a server I'm about to wipe and rebuild. I have a backup at a remote location but I want the files locally so I can fool around with them and pick and choose what i want on the server. So I want to rsync certain directories over ssh.
Here's what I'm doing.
My rsync command:
rsync -avz -e "ssh -p 22" mjboa@site:/etc/ /home/mike/Documents/Projects/site_backup_12_3_09/etc/ --rsync-path="sudo rsync"

This worked on a different directory so I know I have the basics down.
The confusing part is that I need root access on the remote machine to read /etc but I don't want to PermitRootLogin on sshd.
So I read somewhere that I can set it so that I don't need to enter a password for sudo with just rsync and I can set the command rsync runs on the remote machine. Makes perfect sense.

So I have my sudoers on the remote machine:
mjboa ALL=PASSWD: ALL, NOPASSWD:/usr/bin/rsync

I see nothing wrong with this, even through the screwed syntax of sudoers, and I've had trouble with sudoers before.

What I get out of this is when i log in as mjboa on my server, I don't get prompted for a password at all, for any command.
And when I run the rsync command, it actually prompts me for a password! And it displays it in plain text and does nothing when I enter it.
What the hell is going on? Someone has to have done this successfully before.

Thanks.
Has anyone solved this? I have a dynamic IP for my workstation, and it won't be an option to rsync from server to workstation...

I know that I can set --rsync-path='sudo rsync' ... but I have to disable requiretty, and that's pretty insecure if I understand correctly...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync with ssh mahmoud Linux - Security 4 02-20-2008 11:16 AM
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 12:10 PM
I deleted /etc/sudoers and creates a new file call sudoers but now it doesnt for visu abefroman Linux - Software 1 11-10-2005 05:03 PM
rsync and ssh? IchBin Linux - Newbie 4 02-13-2005 03:41 PM
Rsync and SSH Phaethar Linux - Software 3 03-22-2004 03:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration