FG
💻 Software

Standard way to duplicate a file's permissions

Fresh5 days ago
Mar 15, 202613573 views
Confidence Score0%
0%

Problem

I am trying to find a standard POSIX way to duplicate one file's permissions to another file. On a GNU system this is easy: Unfortunately, the --reference flag to chmod is a non-standard option. So that is out for my purposes. I would prefer it to be a one-liner, but that's not necessary. Ultimatel…

Error Output

[alexmchale@bullfrog ~]$ ls -l hardcopy.*
-rw-r--r-- 1 alexmchale users 2972 Jul  8 20:40 hardcopy.1
---------- 1 alexmchale users 2824 May 14 13:45 …

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Standard way to duplicate a file's permissions

Low Risk

You can use the command to get the file permission : Mac OS X (BSD) syntax : chmod `stat -f %A fileWithPerm` fileToSetPerm Linux syntax (not sure) : chmod `stat -c %a fileWithPerm` fileToSetPerm The ` symbol is a backquote.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment