微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 整个文件系统的备份权限

这是瘦的:我有一个Linode VPS,我想通过rsync备份到我的本地笔记本电脑.我刚刚为通信生成了ssh密钥,并为私钥留下了一个空白密码,因此我可以通过cron进行rsync,而无需担心密码.

为了更加安全,我还拒绝了root ssh登录.理想情况下,我希望从/向下备份所有内容,但除非我给特定用户rwx访问所有内容,否则使用普通用户根本不可能.

在不允许root登录的情况下,通过rsync备份整个文件系统的最佳方法是什么?

解决方法

使用root帐户:只有uid 0才能读取整个文件系统.

现在,由于您希望提高安全性,以下是您可以执行的操作:

>禁止root通过ssh使用密码登录(sshd config中的PermitRootLogin无密码).
>使用密钥身份验证进行备份.

根据man 5 sshd_config

"     PermitRootLogin
             Specifies whether root can log in using ssh(1).  The argument
             must be ``yes'',``without-password'',``forced-commands-only'',or ``no''.  The default is ``yes''.

             If this option is set to ``without-password'',password
             authentication is disabled for root.

             If this option is set to ``forced-commands-only'',root login
             with public key authentication will be allowed,but only if the
             command option has been specified (which may be useful for taking
             remote backups even if root login is normally not allowed).  All
             other authentication methods are disabled for root.

             If this option is set to ``no'',root is not allowed to log in."

从未尝试过“强制命令”参数,但它看起来很有趣.

原文地址:https://www.jb51.cc/linux/395771.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐