不信任来自不受信任的用户 root、dev 组的文件 .hg/hgrc

发布于 2024-12-21 11:41:26 字数 756 浏览 1 评论 0原文

该存储库由用户 root 和组 dev 所有。

另一个用户正在存储库上运行 hg update 并收到以下消息:

Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file .hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
abort: Permission denied: /dev/src/backend/java/com/tt/afr/schedule/service/ScheduleComparator.java

/etc/mercurial/hgrc 中,我们有:

trusted.users=root

在运行hg update的用户的主目录中,我们有这个hgrc文件:

[trusted]
users = root
groups = dev

用户正在使用ssh连接到服务器并运行命令。

我们可以做什么来解决这个问题?

The repository is owned by user root, and group dev

Another user is running hg update on the repository and getting the following messages:

Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file .hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
Not trusting file /dev/.hg/hgrc from untrusted user root, group dev
abort: Permission denied: /dev/src/backend/java/com/tt/afr/schedule/service/ScheduleComparator.java

In /etc/mercurial/hgrc, we have:

trusted.users=root

In the home directory of user running hg update, we have this hgrc file:

[trusted]
users = root
groups = dev

User is connecting to server using ssh and running the commands.

What can we do to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

海夕 2024-12-28 11:41:26

请阅读有关 Mercurial 信任的帮助,并确保您已添加信任设置在服务器上。当您通过 SSH 连接时,您在本地信任或不信任谁并不重要 - 您在服务器上运行的 hg 二进制文件(通过 SSH 隧道)需要信任配置文件。

另请注意,您需要将

[trusted]
users = root

/etc/mercurial/hgrc 文件放入服务器上。我们在讨论配置设置时使用的 section.key = name 语法仅适用于命令行。

Please read the help on trust in Mercurial and make sure that you've added the trust settings on the server. When you connect over SSH, it does not matter who you trust or don't trust locally — it's the hg binary that you run on the server (via the SSH tunnel) that needs to trust the config file.

Also note that you need to put

[trusted]
users = root

in the /etc/mercurial/hgrc file on the server. The section.key = name syntax we use when talking about configuration settings only work on the command line.

许你一世情深 2024-12-28 11:41:26

对于已将此解决方案添加到其 /repo/.hg/hgrc 但没有发生任何事情的其他人,此解决方案对我有用:
https://j.ee.washington.edu/trac/gmtk/ticket/33

添加在 /etc/mercurial/hgrc.d/trust.rc

[trusted]
groups = yourgroup
users = youruser

,本质上,对 /repo/.hg/hgrc 的写入权限将不起作用,因为该文件本身由不受信任的用户拥有。

For everybody else who has added this solution to their /repo/.hg/hgrc and nothing happened, this solution worked for me:
https://j.ee.washington.edu/trac/gmtk/ticket/33

Add in /etc/mercurial/hgrc.d/trust.rc

[trusted]
groups = yourgroup
users = youruser

Essentially, writing permissions to /repo/.hg/hgrc will not work, because the file itself is owned by an untrusted user.

尤怨 2024-12-28 11:41:26

根据DustWolf的回答,这可以在WSL(Linux的Windows子系统)下的Ubuntu上使用使用Microsoft的WSL drvfs文件系统驱动程序(即hg 在共享驱动器上本地运行。

not trusting file /mnt/x/repo/.hg/hgrc from untrusted user root, group root
Mercurial Distributed SCM (version 5.3.1)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2020 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

在 WSL 计算机上创建 trust.rc

sudo touch /etc/mercurial/hgrc.d/trust.rc
sudo nano /etc/mercurial/hgrc.d/trust.rc

添加:

[trusted]
groups = root
users = root

保存 trust.rchg 现在应该信任存储库 hgrc 因为 WSL 的 drvfs 驱动程序将共享挂载为 root:root。

Based on the answer by DustWolf, this works on Ubuntu under WSL (Windows Subsystem for Linux) using a Windows drive letter share mounted using Microsoft's WSL drvfs file system driver, i.e., hg running locally on a shared drive.

not trusting file /mnt/x/repo/.hg/hgrc from untrusted user root, group root
Mercurial Distributed SCM (version 5.3.1)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2020 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Create trust.rc on the WSL machine:

sudo touch /etc/mercurial/hgrc.d/trust.rc
sudo nano /etc/mercurial/hgrc.d/trust.rc

Add:

[trusted]
groups = root
users = root

Save trust.rc and hg should now trust the repo hgrc as WSL's drvfs driver mounts the share as root:root.

北凤男飞 2024-12-28 11:41:26

不是你的情况,但可能值得提示:

我在设置为将存储库从 hg 迁移到 GitLab 的本地容器中遇到此错误。只需将下载的 hg 存储库文件夹中的 .hg 目录的所有权更改为 root 用户/组即可解决此问题:

chown -R root:root .hg

并且消息 not trusting file /data/hg-repo/.hg来自不受信任的用户 1000、组 1000 的 /hgrc 消失了。

Not your case, but might be worth a hint:

I had this error in a local container that was setup to migrate repos from hg to GitLab. Solved it by just by changing the ownership of the .hg directory in the downloaded hg's repository folder to root user/group:

chown -R root:root .hg

And the message not trusting file /data/hg-repo/.hg/hgrc from untrusted user 1000, group 1000 was gone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文