这是瘦的:我有一个Linode VPS,我想通过rsync备份到我的本地笔记本电脑.我刚刚为通信生成了ssh密钥,并为私钥留下了一个空白密码,因此我可以通过cron进行rsync,而无需担心密码.
为了更加安全,我还拒绝了root ssh登录.理想情况下,我希望从/向下备份所有内容,但除非我给特定用户rwx访问所有内容,否则使用普通用户根本不可能.
解决方法
使用root帐户:只有uid 0才能读取整个文件系统.
现在,由于您希望提高安全性,以下是您可以执行的操作:
>禁止root通过ssh使用密码登录(sshd config中的PermitRootLogin无密码).
>使用密钥身份验证进行备份.
- " 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."
从未尝试过“强制命令”参数,但它看起来很有趣.