bug#79488: [RFE] Enhancement idea : Better Handling of File Permission with CHMOD Command

"Mahish Sivan S (Nokia)" via GNU coreutils Bug Reports <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <DB9PR07MB9954461714F8468936B98E3DA012A@DB9PR07MB9954.eurprd07.prod.outlook.com>
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.

Best regards,
S. Mahish Sivan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.