TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Should I Use the Root User for Backing Up Linux Server?

3 pointsby EyebrowsWhiteabout 1 year ago
When doing partial backups (e.g., &#x2F;etc, &#x2F;home, &#x2F;data), is it better to create a dedicated user for backups or to use the root user?<p>Currently, I&#x27;m using a dedicated user with ACL permissions, but I&#x27;ve run into two issues:<p>1. Some files, like the private keys in &#x2F;etc&#x2F;ssh, need to have permissions set to 600. Forcing ACLs changes permissions to 640, making SSH login impossible.<p>2. After setting ACL permissions on a directory, newly added files don&#x27;t retain those ACL permissions.<p>Using the root user seems to provide excessive permissions. How do you handle this in your practice?

3 comments

elmerfudabout 1 year ago
I use a dedicated backup user, and setfacl does allow inheritance of its acl on newly created things. I can&#x27;t look it up now but I&#x27;m sure a Google search will find it. It can also prevent the 640 as well because those acls are different than the normal mask.<p>I think what you might be doing is applying a group acl instead of a user acl. In my setup I use normal Unix group permissions for some things, acls that apply group permissions for most things, but for homes I put my backup account as acl user permissions for read.<p>Could you use root? Sure, but you would need to evaluate the risk in that. As root is &quot;do all the things&quot; account. The backup account can still read all the things so you still have data loss exposure but it can&#x27;t modify the things.
评论 #40582398 未加载
stop50about 1 year ago
most backup programs run with root or at the targets own user. There is the possibility to circumvent the permission checks: capabilities. the provide parts of the root user to unprivileged processes, in your case CAP_DAC_READ_SEARCH should be enough for the backup process itself. for restore it would need a bumch of caps set, like CAP_DAC_OVERRIDE, CAP_CHOWN and maybe more
talldayoabout 1 year ago
&gt; How do you handle this in your practice?<p>Create a normal user, make them a sudoer, and then log back in as the other account.