linux owner 只认名字,Linux更改組權限以匹配所有者權限

Suppose I have a directory on Linux with a bunch of files and subdirectories. This is that root directory:

假設我在Linux上有一個目錄,包含一堆文件和子目錄。這是根目錄:

drwxr-xr-x 13 user1 group1 4096 May 7 15:58 apps

Now, I only want to alter the group portion of those permissions. I want to alter it in such a way that it exactly matches the owner portion. The result for that directory would be:

現在,我只想更改這些權限的組部分。我想以一種與所有者部分完全匹配的方式改變它。該目錄的結果將是:

drwxrwxr-x 13 user1 group1 4096 May 7 15:58 apps

But, I want a script or command to do this automatically, not just for that directory but for every subdirectory and file recursively under it. Anyone know how?

但是,我想要一個腳本或命令自動執行此操作,不僅針對該目錄,而且針對每個子目錄和文件遞歸地執行此操作。誰知道怎么樣?

Thanks.

謝謝。

2 个解决方案

#1

40

Give this a try (test it first):

嘗試一下(首先測試):

chmod -R g=u apps

The = copies the permissions when you specify a field (u, g or o) on the right side or sets it absolutely when you specify a permission (r, w or x) on the right.

=當您在右側指定字段(u,g或o)時復制權限,或者在右側指定權限(r,w或x)時將其設置為絕對。

#2

3

That's simple:

這很簡單:

chmod g=u

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值