1

As from object, I want to mount some directories (with binding) at login and possibly unmount them at logout.

At the beginning I tought about autofs, but it dynamically creates mount points, that's ok with cli, but not when using filemanagers, it's really annoying to have to write a directory name to make it spawn.

Another solution I considered is running a login script, and it works. My problem now is that I don't know how to unmount them. I use LightDM, so .bash_logout is not an option, and also if that login manager can trigger a script when logging out, it runs system wide, and I'd prefer a solution user based.

Thanks in advance

4
  • 1
    You can configure autofs to present directory names even when the underlying filesystem is not mounted. Would that be sufficient? Commented Mar 26, 2024 at 17:03
  • What logout script are you referring to ? session-cleanup-script ? In which case it is called with USER/LOGNAME/HOME set. What about testing them in the script before deciding to unmount or not ? (I can provide more details if needed) Commented Mar 26, 2024 at 18:23
  • @ChrisDavies it's exactly what I was trying to do, but I can't figure out which option I have to set. Commented Mar 27, 2024 at 9:08
  • @MC68020 Yes, session-cleanup-script. I didn't know those env vars get set. Can you please tell me where I can find more details on the documentation? I excluded to test the mountpoints in the script as general approach because I'm looking for a cleaner and a more straightforward solution. Commented Mar 27, 2024 at 9:15

1 Answer 1

1

Regarding a possible solution resorting to some logout script, LighDM conforms to the freedesktop specification which, given this setting :

[SeatDefaults] … session-cleanup-script=command … 

Will trigger command to be

run after a greeter or user session stops. It is run as root.

Since, according to some LightDM mailing list thread on the topic :

scripts are called with USER/LOGNAME/HOME set,

You should simply be able to design a user dependent logout script.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.