On Wed, Mar 02, 2022 at 09:46:23AM +0100, Antal Koós wrote:
> The symptom:
> There are two users on a host 'debhost'.
> I make 'su' from'user1' to 'user2', and create a file on /dev/shm.
> I make 'scp' from another host for 'user2@debhost', but target is the
> $HOME and not the /dev/shm.
> Result: the file disapperars from /dev/shm.
I am able to reproduce this, with one possibly important note: the
removal is not immediate. It happens after a few seconds (less than
10 seconds in my testing).
I didn't use a second computer. I just used one. "su" is also not
required; I used "sudo -i -u tester" to open the session as the second
user account.
Here's the first window:
unicorn:~$ sudo -i -u tester
[sudo] password for greg:
tester@unicorn:~$ touch /dev/shm/tester
tester@unicorn:~$ inotifywait --monitor /dev/shm/tester
Setting up watches.
Watches established.
/dev/shm/tester ATTRIB
/dev/shm/tester DELETE_SELF
Here's the second:
unicorn:~$ scp foo tester@localhost:
tester@localhost's password:
foo 100% 21 65.6KB/s 00:00
The final two lines in the first window (ATTRIB and DELETE_SELF) appeared
about 8 seconds after the scp command finished.
I don't know exactly what's happening here, but my initial guess is
that it has something to do with session cleanup. The scp command
opens a session as "tester" (or "user2"), does its work, and then
terminates the session.
Someone who knows systemd, dbus, and all that stuff might be able to
suggest next steps.