如何正确使用组访问和chgrp?

发布于 2024-10-04 13:52:48 字数 480 浏览 1 评论 0原文

我尝试使用 SSH 将文件部署到远程服务器。

我的用户名 joe 是组 www 的成员。

我以 joe 身份通过 SSH 登录,并创建一个新文件夹(我们称之为 test)。父文件夹的所有者是root:www。当我通过 ssh 发出 mkdir /parent/test 命令时,新目录的所有者是 joe:joe。我希望将组设置为 www

如果我尝试发出命令 chgrp www /parent/test,我会收到权限被拒绝的错误。
最终,我并不关心文件的所有者是谁,尽管如果文件的所有者是 www:www 那就太好了。我只想能够在以用户名登录的同时在远程服务器上创建文件,然后将文件组更改为 www

提前致谢。

I attempting to deploy files to a remote server using SSH.

My username joe is a member of the group www.

I am SSH'ing in as joe, and creating a new folder (let's call it test). The parent folder's owners are root:www. When I issue the mkdir /parent/test command over ssh, the owners for the new directory are joe:joe. I'd like the group to be set to www.

If I attempt to issue the command chgrp www /parent/test, I get a permission denied error.
Ultimately, I don't care about who the owner of the file is, although if the file's owners were www:www that would be nice. I just want to be able to create files on the remote server, while logging in as my username, and then change the group of the files to www.

Thanks in advance.

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

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

发布评论

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

评论(1

自演自醉 2024-10-11 13:52:48

在使用 mkdir“登录”新组之前尝试使用 newgrp

mymachine$ ssh joe@remotemachine
remotemachine$ newgrp www
remotemachine$ mkdir /parent/test

Try using newgrp before using mkdir to "log in" to a new group

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