Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Is it multi-user?

by pileofrogs (Priest)
on Dec 04, 2005 at 17:42 UTC ( #513975=perlquestion: print w/replies, xml ) Need Help??
pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing some tests of file ownership, which obviously are pointless if the system isn't a multi-user system. Is there a best way to determine if the system my thing is running on is in fact a multi-user system?


Update: Thanks for your responses! I'll try to clarify my question:

  • This is actually more of an academic question than a practical question.
  • I'd like to avoid checking a great big list of OSs.
  • For this question, I'm defining multi-user as any environment in which the idea of file ownership is valid. So, maybe a more precise way of asking my question is, is there a 'best' way to determine if the system supports the idea of file ownership.

Another Update: Oh, and you can have Os's with multiple file systems, some of which do and some of which do not support the idea of file ownership.... Ugh...

I think I'd really like a command or set of commands that will succeed in on a system that supports the idea of file ownership and fail on a system that does not.

Yet Another Update: When I say, I'd like to avoid checking a big list of operating systems, I mean I'd like this to work on an OS I've never heard of. I'd like it to work on an OS that doesn't exist yet.

Replies are listed 'Best First'.
Re: Is it multi-user?
by virtualsue (Vicar) on Dec 04, 2005 at 17:51 UTC
    What if it's a multi-user operating system with only one user? :) OK, more seriously, you can check the operating system name via the special scalar variable $^O.

    perldoc perlvar has very useful info for $^O, including what to do if you want greater precision in distinguishing between versions of MS Windows.

Re: Is it multi-user?
by jonadab (Parson) on Dec 04, 2005 at 18:56 UTC

    Hmmm... I'm not sure there's any general way to determine that, without ennumerating and testing for specific systems. Why do you need to know? Do the tests have an adverse effect if they're unnecessary? Are they run often enough to impact performance? What happens on a single-user system (e.g., BeOS, MacOS 9, or DOS), that you want to avoid?

    Also, how are you defining "single-user system"? Does Windows 98 count, even though it has a concept of user accounts? Why? Because only one can be active at a time, or because the filesystem doesn't have a concept of file ownership? Which? If the latter, would a Linux system count if the files in question are on a vfat or UMSDOS filesystem?

      Just as a passing note, Mac OS 9 and below (I'm not sure how far back, but a fair number of revisions) did in fact support the notion of files owned by different people, though they rarely (prior to OS 9) did anything much with it.

      If God had meant us to fly, he would *never* have given us the railroads.
          --Michael Flanders

Re: Is it multi-user?
by GrandFather (Sage) on Dec 04, 2005 at 21:40 UTC

    Perhaps a better question is: Is this OS CP/M or MS/DOS? Not many operating systems in wide use after that are not multi-user by your criteria. I suspect if you ask yourself, "what context might I expect this to run in that isn't multi-user", the the question almost answers itself.

    DWIM is Perl's answer to Gödel

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://513975]
Approved by virtualsue
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-05-28 19:52 GMT
Find Nodes?
    Voting Booth?