0

I need to clear tmpfs after each logout from system (Ubuntu x86_64).

6
  • what do you mean? so any user will clear it at logon? what is the purpose? more details will help you get a better answer. Mar 24, 2015 at 8:58
  • The user will repeatedly logout . I need get the mountpoint in tmpfs without data at each logout (without reboot).
    – vinegret
    Mar 24, 2015 at 9:23
  • so you just want the mount point of tmpfs? grep '^tmpfs' /proc/mounts Mar 24, 2015 at 9:27
  • no, i want to erase all data after logout (easier to just remount).
    – vinegret
    Mar 24, 2015 at 9:36
  • vinegret, a umount/mount ("remount") will not clear the file system, it will just "disconnect"/"reconnect" it from/to the file system hierarchy.
    – Janis
    Mar 24, 2015 at 14:53

1 Answer 1

4

Take a look at pam-tmpdir and pam-mount.

pam-mount mounts and unmounts directories when PAM sessions are started and finished (which includes when users log in and out).

pam-tmpdir creates a user-specific temporary directory each time someone logs in, which may come in handy if you're trying to isolate users from each other.

Note that in any case there may be daemons which have files in /tmp that they expect to keep around longer than a user's session; so I'd recommend going with a user-specific temporary directory, using either pam-mount or pam-tmpdir.

2
  • Thank you, this is what I need. But i don't found a this packages for x64 architecture (Ubuntu 14.04).
    – vinegret
    Mar 25, 2015 at 5:22
  • In Debian and Ubuntu, the packages are respectively libpam-tmpdir and libpam-mount. Mar 25, 2015 at 5:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .