Live data from Hacker News

Unix file access rwx permissions are simple but tricky

igoro.pro

61–70 of 77 posts

Re: Unix file access rwx permissions are simple but tricky

#61

Earlier quoted context omitted.

We're sharing a computer as we speak.

Right, in the sense of "the network is the computer". Tangent: one of the most talented engineers I ever met gave an amazing (tho sadly company-private, unrecorded) talk about how the OS was his IDE. Kind of analogous... anyway, I like this type of re-framing or meta-level-shifting.

he must be getting a bit twitchy lately then

Re: Unix file access rwx permissions are simple but tricky

#62
post #3

Earlier quoted context omitted.

Those multiple users could be used to implement sandboxing. And of course if one has a family then one might want accounts for Mom, Dad, Alice and Bob.

Yea, I'd like to see a system where each application runs as its own user, especially third party applications not vetted by the OS vendor, the package manager and so on. Maybe this already exists--I think it would be a good step forward for security and privacy. You can no longer trust 3rd party applications to stay in their lanes. Running an application with full access to everything that I as a user have access to…

> Maybe this already exists

That's how Android works.

Re: Unix file access rwx permissions are simple but tricky

#63

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/process has an open handle to it, and this is something Linux doesn't care to handle and MINIX does (or perhaps just that a kernel/filesystem should handle it, and few do -- I don't recall exactly). Surely an edge case (logging? what else? I never keep files open…

The existing pattern leads to very useful usecases though: there are resources a server only needs to open once (e.g. during startup), and being able to then remove access while holding onto the one handle you're going to use is a security win.

Re: Unix file access rwx permissions are simple but tricky

#64

Earlier quoted context omitted.

Not a problem in practice. I've seen a lot of systems having user homes in places other than /home for various (usually historical) reasons. Never broke anything afaik.

It probably is fine. Still makes my spider sense tingle about some unforeseen failure that will crop up one day.

I've seen scripts with hardcoded "/home/$username" so your worries aren't entirely unfounded.

It's understandable too, because Linux doesn't provide a nice way to retrieve that information. You'll have to parse /etc/passwd (which might not contain all users) or hope that whatever language you're using supports path extrapolations so that you can do realpath(~username) or call a third party tool that does, like a shell.

Re: Unix file access rwx permissions are simple but tricky

#65

Earlier quoted context omitted.

>Sticky bit Interestingly, I have come across some people who confuse the sticky bit with the setuid bit.

It's pretty common for people the misuse the terminology but not the semantics.

...especially when they don't read documentation as often as they should ;)

ahem

Yes, I mean the setuid bit. The bit that makes the groups work for read/write to a directory. The same bit that's dangerous if it's set for a root user or group, and can be iffy if it's executable... yes that bit.

Re: Unix file access rwx permissions are simple but tricky

#66
post #9
post #3

Earlier quoted context omitted.

Those multiple users could be used to implement sandboxing. And of course if one has a family then one might want accounts for Mom, Dad, Alice and Bob.

Depressingly i think sharing computers at least in the western world has become a thing of the past. At the very least, sharing your main form of computing.

Using computers in general outside of work is quickly becoming a thing of the past too.

Re: Unix file access rwx permissions are simple but tricky

#67

Earlier quoted context omitted.

It took me a shockingly long amount of time before I realized it was silly to have a username on my machines. I am the only person using this, why am I typing unnecessary cruft? Username switched to “a”, which ends up saving space in my home path and terminals.

It took me a shockingly long amount of time before I realized it was silly to have a username on my machines. I am the only person using this, why am I typing unnecessary cruft? Username switched to “root” on all my machines and I remove the username from PS1. /root is shorter than /home/a (:

Once I had this thought and renamed the root user to my own name. Hilarity ensued.

Re: Unix file access rwx permissions are simple but tricky

#68
post #3

Earlier quoted context omitted.

Those multiple users could be used to implement sandboxing. And of course if one has a family then one might want accounts for Mom, Dad, Alice and Bob.

Yea, I'd like to see a system where each application runs as its own user, especially third party applications not vetted by the OS vendor, the package manager and so on. Maybe this already exists--I think it would be a good step forward for security and privacy. You can no longer trust 3rd party applications to stay in their lanes. Running an application with full access to everything that I as a user have access to…

u would either need to statically includw everything in the binaries all the time causing huge files everywhere, or use something like bsd jails. both is doable. then it is still possible to access the kernel though. so its highly impractical. as other guy pointed out Android somewhat works like that, but lots of malicious programs also exist for that..

Re: Unix file access rwx permissions are simple but tricky

#69
post #9
post #3

Earlier quoted context omitted.

Those multiple users could be used to implement sandboxing. And of course if one has a family then one might want accounts for Mom, Dad, Alice and Bob.

Depressingly i think sharing computers at least in the western world has become a thing of the past. At the very least, sharing your main form of computing.

?? not all households have money to buy pc for everyone. for phones maybe (also less common outside of rich countries), but definitely not true for pc platform, for most of the world actually.. there a lot of pcs for the family still.

Re: Unix file access rwx permissions are simple but tricky

#70
post #62

Earlier quoted context omitted.

Yea, I'd like to see a system where each application runs as its own user, especially third party applications not vetted by the OS vendor, the package manager and so on. Maybe this already exists--I think it would be a good step forward for security and privacy. You can no longer trust 3rd party applications to stay in their lanes. Running an application with full access to everything that I as a user have access to…

> Maybe this already exists That's how Android works.

In the early days, nowadays not only it does that still, it also has LinuxSE and seccomp enabled, and Linux drivers are seen as legacy, modern drivers run out of process as well, on their own accounts, talking via Android IPC with the kernel.
Post reply on HN