TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Unix file access rwx permissions are simple but tricky

67 pointsby hyzyla9 months ago

6 comments

teo_zero9 months ago
It&#x27;s counterintuitive that the owner can have <i>less</i> rights than the others. Honestly, I&#x27;ve never seen it put in practice in any real-world file system.<p>Incidentally, this is also not very efficient: UNIX permissions as they are today require 9 bits, namely rwx for owner, rwx for group, and rwx for others. But in an alternative universe where owner&#x27;s rights win over group&#x27;s rights which win over others&#x27; rights, permissions could be coded in just 6 bits: 2 to express who can read, 2 for who can write, and 2 for who can execute. Each set of 2 bits would be interpreted this way: 00=nobody, 01=only owner, 10=group or owner, 11=everybody.
评论 #41261558 未加载
评论 #41262075 未加载
评论 #41262065 未加载
评论 #41261692 未加载
meonkeys9 months ago
I attended a Tanenbaum lecture once where he talked about how silly it was that nothing happens if permissions are reduced for a file while some other user&#x2F;process has an open handle to it, and this is something Linux doesn&#x27;t care to handle and MINIX does (or perhaps just that a kernel&#x2F;filesystem should handle it, and few do -- I don&#x27;t recall exactly). Surely an edge case (logging? what else? I never keep files open for too long), but I thought it was an interesting one.<p>You can test this in Bash: userA does cat&gt;&#x2F;tmp&#x2F;newfile (assuming a chmod or relaxed umask so &#x2F;tmp&#x2F;newfile is created with permissions 0664), userA types in lines of text every few seconds, userB does tail -f &#x2F;tmp&#x2F;newfile and watches lines appear, then userA does chmod 600 &#x2F;tmp&#x2F;newfile, but userB can continue to tail -f &#x2F;tmp&#x2F;newfile and watch lines appear.
评论 #41261716 未加载
评论 #41262467 未加载
评论 #41261739 未加载
1oooqooq9 months ago
The nicer things are suid a guid.<p>suid is to run things as another user without passwords. Mostly used for root access today and ignored for anything else. I personally think that&#x27;s a missed oportunity when they added the unshare&#x2F;namespace&#x2F;capdrop stuff... would have been so nice if the interface to containers was a freaking simple &#x27;suid as this lowly user&#x27; for a userland api. anyway.<p>and guid ON DIRECTORIES, are so that users can save files in a groups that then others can also update. So you can have `&#x2F;srv&#x2F;http&#x2F;htdocs userA webmasters -rwxswx---`<p>then there&#x27;s umask which may help or get in the way. and getfacl et al.<p>overall it&#x27;s a mess that covers many usecases after you&#x27;ve been initiated.
remram9 months ago
Interesting, I was just diving into the permission system today. I was wondering if it was possible to delegate administration of a directory, e.g. give permission to some non-root user to delete files created by others in that directory.<p>Turns out it doesn&#x27;t seem possible. Even if you use ACLs, whatever default ACL you set can just be removed from sub-directories by their respective owners. This seems like a big blind spot, unless I just missed something; all those groups, access lists, bits, and I can&#x27;t even do that?
评论 #41262112 未加载
jcovik9 months ago
I actually never had the idea. It&#x27;s truly unintuitive.
saulpw9 months ago
I&#x27;ve been wondering about this for awhile. Do we really need multiple users for desktop unix? I get that you want some division between system and user, to protect the user against themselves. And read-only files are similarly useful, if only because some devices are read-only. But do we really need user&#x2F;group&#x2F;other permissions for desktop unix? and all the complexity of groups, and euid, etc.<p>Edit: not sure why I&#x27;m getting downvoted. Is it that offensive to question orthodoxy?
评论 #41260757 未加载
评论 #41260671 未加载
评论 #41261283 未加载
评论 #41260987 未加载
评论 #41261951 未加载
评论 #41261793 未加载
评论 #41260990 未加载
评论 #41260900 未加载
评论 #41260728 未加载
评论 #41261623 未加载
评论 #41261945 未加载
评论 #41261342 未加载
评论 #41261815 未加载
评论 #41261101 未加载