Cygwin 中的 Vshadow.exe 错误,但仅通过带有公钥身份验证的 ssh 出现

Cygwin 中的 Vshadow.exe 错误,但仅通过带有公钥身份验证的 ssh 出现

我想通过 ssh 从 Cygwin 内部创建卷影副本(vshadow 2.2):

$ ./vshadow.exe -p -nw C:
(...)
- Setting the VSS context to: 0x00000019
Creating shadow set {a5e0883e-9485-4243-8276-1ac7c569ab6a} ...
- Adding volume \\?\Volume{218a908d-1e3f-11df-a215-806e6f6e6963}\ [C:\] to the shadow set...
Creating the shadow (DoSnapshotSet) ...

ERROR: COM call "m_pVssObject->DoSnapshotSet(&pAsync)" failed.
- Returned HRESULT = 0x80070005
- Error text: Access is denied.

我猜这是因为 Cygwin 运行的本地 Windows 用户cyg_server没有某种权限。

我尝试过的事情:

  1. 当我在“我的电脑”中右键单击 C: 时,安全选项卡下的高级选项会出现,但我没有看到任何相关内容
  2. 它说要重新运行/tracing。我看不出故障点周围有什么有用的信息
  3. 我进入了 Windows 中创建公开挂载点的目录,并授予了cyg_server完全控制权。没有变化。
  4. 按照描述创建了 VSSAccessControl 键这里。 不用找了。
  5. 成为cyg_server域管理员成员。没有变化。
  6. 没有使用开关的 vshadow -nw,得到的却是这样的:

    $./vshadow.exe -p C: (...)

    • 将 VSS 上下文设置为:0x00000009(正在收集编写器元数据...)(正在等待异步操作完成...)上次异步操作期间出错。
    • 返回的 HRESULT = 0x80042318
    • 错误文本:VSS_E_WRITER_INFRASTRUCTURE

如何使用公钥认证通过 ssh 创建快照?

更新: 我发现此主题来自 2007 年提到如果使用公钥身份验证则无法做到这一点。我已经验证过,如果我重命名我的 id_rsa 文件并使用密码登录,它就可以工作(无论是否使用开关-nw)。但我需要使用公钥身份验证才能制作备份脚本。作者没有提到为什么会这样,但我猜在过去的六年里它还没有被修复过……有解决方法吗?

答案1

您能使用您的公钥进行正常的复制/连接吗?

您可能还想检查 backupcentral 网站上的帖子,其中一位用户发布了他使用 Windows 2003 设置的内容以及他使用的脚本。

使用 cygwin、公钥和 rsync 备份 Windows 2003

问题的关键在于使用at命令来运行某些东西,NT AUTHORITY\SYSTEM因为出于某种原因,使用公钥而不是密码登录会让你在 Cygwin 下以不同的用户身份运行。引用:

# Launches passed input via 'at' to get around $USERNAME=SYSTEM
# problem under ssh login where the shell lacks permsisions to run
# commmands like vshadow or dosdev
# from a script by Jeffrey J. Kosowsky
function at_launch ()
{
local h m s wait1 command
if [ $3 != "" ] ; then
command="${1} ${2} >> ${3}"
else
command="${1} ${2}"
fi

set -- $(date +"%H %M %S")
h=$((10#$1)) #Note explicitly use base 10 so that 08 and 09 not interpreted as bad octal
m=$((10#$2 +1)) #Advance minutes by 1
s=$((10#$3))
wait1=$((60 - $s))
[ $s -gt 55 ] && let "m += 1" "wait1 += 60" # Make sure >5 seconds left
[ $m -ge 60 ] && let "m %= 60" "h += 1" #Overflow minutes
let "h %= 24"
at $h:$m $(cygpath -w $(which bash.exe)) -c "$command"
# > /dev/null

echo Running '$command' at $h:$m
return $wait1
} 

相关内容