bug#79488: [RFE] Enhancement idea : Better Handling of File Permission with CHMOD Command
Pádraig Brady <[email protected]>
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 22/09/2025 06:55, Mahish Sivan S (Nokia) via GNU coreutils Bug Reports wrote: > Hello coreutils team, > > I would like to suggest an improvement to the "CHMOD" utility in GNU coreutils. > > Current behaviour: > ----------------------- > The chmod command allows us to change file permissions. However, in the current implementation, it does not support granting permissions for a specific time period. > > Suggestion for improvement: > ----------------------------------- > Introduce a new time flag (for example, `-t`) that accepts a duration in minutes. With this option, users could grant permissions to a file for a specific time period instead of permanently. Once the specified time expires, the file's permissions would automatically revert to their default state. > > Example (if possible): > -------------------------- > $ chmod 777 -t 30 myfile.txt > # Grants full access to "myfile.txt" for 30 minutes > # After 30 minutes, permissions revert to their previous state > > Ex : > > Current: > $ls -al > -r--r--r-- 1 user user 1.1G Sep 18 10:20 file.iso > $ chmod 777 file.iso > -rwxrwxrwx 1 user user 1.1G Sep 18 10:20 file.iso > > Proposed with `-t`: > $ chmod 777 -t 15 file.iso > -rwxrwxrwx 1 user user 1.2G Sep 18 10:20 file.iso > After 15 min > -r--r--r-- 1 user user 1.2G Sep 18 10:20 file.iso > > Rationale: > ------------ > This feature would be useful in scenarios where temporary access needs to be granted, such as: > - Allowing a colleague or process to access a file for a short duration > - Enhancing security by automatically revoking access after the required time window > - Reducing the risk of leaving sensitive files over-exposed due to forgotten manual permission changes > > Environment: > ---------------- > - OS/Distribution: Ubuntu 22.04 > - Coreutils version: cmod (GNU coreutils) 9.1 > > Thank you for maintaining coreutils and considering this suggestion. I'm not sure this is a good idea (what about reboots). In any case it would be best achieved with a tool/script driving the existing functions/utilities rather than with the utilities themselves. thanks, Padraig