> On Oct 16, 2024, at 10:50 AM, Christophe Pettus <x...@thebuild.com> wrote:
>
>
>
>> On Oct 16, 2024, at 09:47, Tom Lane <t...@sss.pgh.pa.us> wrote:
>> I believe it depends on your platform --- some BSDen are pretty
>> permissive about this, if memory serves. On a Linux box it seems
>> to work for processes owned by yourself even if you're not superuser.
>
> I just tried it on an (admittedly kind of old) Ubuntu system and MacOS 14,
> and it looks like shows everything owned by everyone, even from a non-sudoer
> user.
>
Interesting, that’s not my experience. Only root can see the env variables of
another user.
Terminal 1
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ whoami
testusr
$ export FOOBAR=true
$ bash
$ env | grep FOOBAR
FOOBAR=true
Terminal 2
$ whoami
mtice
$ ps e -U testusr | grep -c FOOBAR
0
$ sudo ps e -U testusr | grep -c FOOBAR
1