Accessing /tmp from snaps?

For applications that honor the TMPDIR environment variable, you can work around this by forcing the screenshot application to not write into the system /tmp folder.

IMHO the path of the ssh-agent socket shouldn’t be in the /tmp folder in the first place(it should be in the /run folder according to FHS). I would definitely like this issue to be solve in one way or another, though.

Fortunately its not true. ssh-agent provide authentication for anyone who authorized to ask and the communication socket is where it may be accessible by anyone by design. Directly from ssh sources:

Lets be honest. openssh rely heavily on “/tmp” and this TMPDIR env is not respected often:

and here too: /openssh/openssh-portable/blob/master/session.c#L279

And I believe its by design as it have advantages and no drawbacks.

This is where my ssh-agent PID file is located:

✔ swift3:~> ls /tmp/ssh-*
agent.387988

The question is: can I ask snap to respect mine security requirements? In the end this limitation is making a lot of software not usabe in very unexpected cases. And people think that the issue is with the sofware instead. But its snap fault. And nothing wrong with accessing /tmp as it is designed to be for everyone.

I’m pretty sure ssh-agent should be accessed only by the user’s own processes(as it is supposed to provide the user’s decrypted private keys), which makes the proper path to be /run/user/UID/ssh-XXXXXXXXX according to FHS.

The process PID files should also be stored in the /run directory hierarchy, refer to the FHS specification for more info.

I believe the behavior is just for legacy application compatibility rather than security concerns.

And nothing wrong with accessing /tmp as it is designed to be for everyone.

The major design consideration is that applications tend to misuse this directory and place potentially sensitive personal data there, which can be easily stolen by other applications. While I personally agree the access can be more configurable I disagree that allowing the access is the proper way to be done.

1 Like