LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-25-2015, 01:48 PM   #1
thekraken99
LQ Newbie
 
Registered: Jan 2015
Posts: 6

Rep: Reputation: Disabled
rsync over ssh or daemon , should I run it as root?


So I essentially have 2 questions here. let me explain a little first, I have a server that I provide game servers on, all this game server files run in /home/user/ and then I have some other software such as firewall in /etc/ that I want to backup. Now onto my questions.

Which method is more a more secure viable option when it comes to transfering the files using the rsync daemon or over a encrypted ssh connection?

and to access the files I want to backup from one account I'd have to use root. Which I don't want to do as I have root ssh login disabled, and using root when you don't have to is bad practice. There has to be an easy way to make a user that has access to read all files on the server? Assuming rsync only needs read to copy the files.

What are some typical rsync setups, how do you have the user setup? do you use ssh or the daemon? what files do you backup?
 
Old 01-25-2015, 06:26 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by thekraken99 View Post
Which method is more a more secure viable option when it comes to transfering the files using the rsync daemon or over a encrypted ssh connection? and to access the files I want to backup from one account I'd have to use root. Which I don't want to do as I have root ssh login disabled, and using root when you don't have to is bad practice. There has to be an easy way to make a user that has access to read all files on the server? Assuming rsync only needs read to copy the files.
You're right for not wanting to expose the root user over SSH, that's definitely not a SSH best practice. So that only leaves you with storing files as unprivileged user. To combat mishaps (even if your distro doesn't use a capable package management system that allows you to restore permissions and ownership) DAC data is easily retrieved:
Code:
find /some/dir -printf "%U|%G|%m|%l|%s|%y|\"%p\"\n">/other/path/dir.attr
and easily restored:
Code:
awk -F'|' '{print "chown "$4":"$5, $NF,"; chmod "$6,$NF}' /other/path/dir.attr

Quote:
Originally Posted by thekraken99 View Post
What are some typical rsync setups, how do you have the user setup?
Scripted rsync over SSH with unprivileged user.


Quote:
Originally Posted by thekraken99 View Post
what files do you backup?
Rsync is effective for files that change. With directories containing humonguous amounts of files you may run into time constraints due to checking. Certain things shouldn't be done with rsync like databases: those should be dumped, encrypted and then transferred. You won't gain much from using rsync there.

*Rsync allows you to use a "--log-file", which comes in handy when you want to check syncing details, and both "--dry-run" and "--backup" which comes in handy when testing your backup procedure.
 
1 members found this post helpful.
Old 01-25-2015, 06:32 PM   #3
thekraken99
LQ Newbie
 
Registered: Jan 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Ok so after thinking about this some more I think my solution for the permission will be makign an unprivileged user and giving it permissions to the dirs it needs through ACLS.

Edit: So another though I'm having here, should I run the copy command from the backup server and copy the remote files to the backup server, or run the command on the actuall server and copy them to the backup server. Does it really matter?

I'm thinking from a security and management perspective that if I run it from the backupserver the private key file is only on 1 server, and all the cron and scripts are all on one server.

Last edited by thekraken99; 01-25-2015 at 06:47 PM.
 
Old 01-26-2015, 04:00 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
From a security and management perspective, especially where you need root rights to access certain files (and for example passwd and shadow files should be encrypted before being pushed), you would push backups from each machine to the backup server. When setting up each machine-related backup accounts pubkey do set access and command restrictions and regularly audit logs.
 
Old 01-26-2015, 06:28 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
just some comments:
rsyncd can run as root, and you can configure different modules (or shares or areas) using different accounts and also chroot can be used. You can connect to rsyncd over an ssh tunnel too.
 
  


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 could not run as daemon linux425 CentOS 2 11-04-2014 07:21 PM
logging in as root over rsync/ssh for backups Skaperen Linux - Security 5 10-07-2010 10:50 AM
Could I run rsync to download files from a server without rsync daemon? Richard.Yang Linux - Software 1 09-18-2009 04:08 AM
ssh problem with rsync daemon kitkate Linux - Newbie 4 07-21-2008 09:56 AM
After login attempts, can a script be run from ssh daemon ? frenchn00b Linux - Software 2 01-02-2008 11:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:04 PM.

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