So that:

  • Only process owners, and root, can access information about their processes,
  • Or, at the very least, cmdline permissions are only readable by root, and
  • My system (CentOS 6.x) still runs

Why do I care?

I was just talking to a few developers who I think of as knowledgeable people, and only one out of the three of them knew that, by default, command line arguments for running programs are world-readable.

Incidentally, the topic came up because I was mocking one of them (my brother) for passing a password via command line and he didn't get it, and now I'm worried idiots well meaning but misguided developers might have written programs I actually use, and my authentication tokens might be stupidly and wantonly passed via command line by some of the OSS I have running on my box.

Extra credit

If you could provide solutions for other *nix flavors that don't use /proc but do allow command-line listings (e.g. FreeBSD) , that would be much appreciated.

  • Intelligent != knowledgeable. If they don't know, then they don't know. Once they do, then they do.
    – schroeder
    Jul 9 '14 at 18:40
  • @schroeder True. Edited. Jul 9 '14 at 18:43

On Linux kernel 3.3, this is done with the hidepid= and gid= mount options for /proc (to be added in /etc/fstab). See this answer. Possibly, some distributions which use older kernels may have backported the patch.

On FreeBSD there is a sysctl flag for that, called security.bsd.see_other_uids. See this documentation (search for "see_other_uids").

I am not sure whether other Unix-like systems have similar features. Apparently, back in 2011, there was nothing of that sort in OpenBSD (that's what I infer from that discussion).

One may say that such things matter only if you let hostile people run their code on your machine, which is the traditional "Unix mainframe" concept, but increasingly irrelevant nowadays. In 2014, when people who don't trust each other share the same hardware, they actually run virtual machines which don't see each other.

  • Well, it's also useful if you're worried about being hacked, and you want to layer security as much as possible. If Mallory has hacked my webserver, but that webserver runs as nobody, without a solid /proc nobody can still find out that /bin/herpderp.sh has established a connection to an auditing mysql server on a remote machine using readily available credentials. Jul 9 '14 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.