<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">No, that's not how it works: it is
      launched automatically when the user enters its session, as a
      program launched by the user. The idea is to ensure that it has
      access only to the files of their user.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">El 6/2/20 a las 15:38, Ryan escribió:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAO41-mM_txpHw3-UpS6p+JmHiEZLw65dcJ9LANQ5nVuvpm8Gcg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div>D-Bus exists for this. Given you want, wouldn't you still
          run into the problem of your app then needing to persist
          across multiple user sessions in order to remount everything?
          You can't really do that reliably without a system service.<br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2020, 7:10
              AM Sergio Costas <<a href="mailto:rastersoft@gmail.com"
                moz-do-not-send="true">rastersoft@gmail.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div>
                <div>The problem is that I don't want to have a system
                  service, because I would also need a communication
                  protocol, an arbitration algorithm... I think that
                  there should be an API in logind that would allow a
                  program to block the logout the same than it allows to
                  block shutdown and reboot, and being notified of that.
                  In fact, sometimes I receive a notification in Gnome
                  Shell telling me that Thunderbird is still running and
                  can't close the session... How can I do that? (if it
                  also allows me to detect it and do what I want, of
                  course).<br>
                </div>
                <div><br>
                </div>
                <div>El 6/2/20 a las 6:49, Ryan escribió:<br>
                </div>
                <blockquote type="cite">
                  <div dir="auto">I think what you really want is a
                    system service that talks to your backup app. That
                    way, it can run across user sessions, thus being
                    able to detect session opening, leaving, etc.</div>
                  <br>
                  <div class="gmail_quote">
                    <div dir="ltr" class="gmail_attr">On Wed, Feb 5,
                      2020, 10:55 AM Rastersoft <<a
                        href="mailto:rastersoft@gmail.com"
                        target="_blank" rel="noreferrer"
                        moz-do-not-send="true">rastersoft@gmail.com</a>>
                      wrote:<br>
                    </div>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">
                        <div>Hello:</div>
                        <div><br>
                        </div>
                        <div>I created a backup program that uses an
                          external HD to do the backups, and it is
                          designed to allow several users to share the
                          same hard disk by storing each backup in a
                          different folder. To ensure that the backups
                          are always made, it automatically mounts the
                          backup hard disk when it detects it (using
                          udisk2 DBus interface). The first problem is
                          that if the backup program of the user A
                          mounts the disk, only user A can access it.
                          The second problem is that, if user closes its
                          session as user A and opens a new session as
                          user B, the external hard disk is still
                          mounted as the user A, so the backup program
                          of user B can't access it unless user B
                          manually unmounts it.</div>
                        <div><br>
                        </div>
                        <div>My questions are:</div>
                        <div><br>
                        </div>
                        <div>- Is it possible to mount an external hard
                          disk, using udisk2, making it accessible for
                          all the users?</div>
                        <div>- If not, is it possible to mark a mounted
                          partition as "umount on session close"?</div>
                        <div>- If not, is it possible to detect when my
                          session is being closed, to make the backup
                          program to umount the partition, thus allowing
                          other users to use it?</div>
                        <div><br>
                        </div>
                        <div>About this last question: I already tried
                          to connect to the SessionRemoved signal from
                          logind, but with no luck: I receive the signal
                          when other users close their session, but my
                          program is killed before it can process the
                          signal. Also I tried to use onexit(),
                          atexit(), and GApplication's close signals,
                          but also with no luck: the code isn't  called
                          (I'm using GTK, and the program always dies
                          with a 'broken pipe' message when the session
                          is closed).</div>
                        <div><br>
                        </div>
                        <div>Thanks in advance.<br>
                        </div>
                        <div><br>
                          -- <br>
                          <div dir="ltr"
                            data-smartmail="gmail_signature">Nos leemos<br>
                                             RASTER    (Linux user
                            #228804)<br>
                            <a href="mailto:raster@rastersoft.com"
                              rel="noreferrer noreferrer"
                              target="_blank" moz-do-not-send="true">raster@rastersoft.com</a> 
                                        <a
                              href="http://www.rastersoft.com"
                              rel="noreferrer noreferrer"
                              target="_blank" moz-do-not-send="true">http://www.rastersoft.com</a></div>
                        </div>
                      </div>
                      _______________________________________________<br>
                      freedesktop mailing list<br>
                      <a href="mailto:freedesktop@lists.freedesktop.org"
                        rel="noreferrer noreferrer" target="_blank"
                        moz-do-not-send="true">freedesktop@lists.freedesktop.org</a><br>
                      <a
                        href="https://lists.freedesktop.org/mailman/listinfo/freedesktop"
                        rel="noreferrer noreferrer noreferrer"
                        target="_blank" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/freedesktop</a><br>
                    </blockquote>
                  </div>
                </blockquote>
                <p><br>
                </p>
                <pre cols="72">-- 
Nos leemos
                         RASTER    (Linux user #228804)
<a href="mailto:raster@rastersoft.com" target="_blank" rel="noreferrer" moz-do-not-send="true">raster@rastersoft.com</a>              <a href="http://www.rastersoft.com" target="_blank" rel="noreferrer" moz-do-not-send="true">http://www.rastersoft.com</a>
</pre>
              </div>
              _______________________________________________<br>
              freedesktop mailing list<br>
              <a href="mailto:freedesktop@lists.freedesktop.org"
                target="_blank" rel="noreferrer" moz-do-not-send="true">freedesktop@lists.freedesktop.org</a><br>
              <a
                href="https://lists.freedesktop.org/mailman/listinfo/freedesktop"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/freedesktop</a><br>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Nos leemos
                         RASTER    (Linux user #228804)
<a class="moz-txt-link-abbreviated" href="mailto:raster@rastersoft.com">raster@rastersoft.com</a>              <a class="moz-txt-link-freetext" href="http://www.rastersoft.com">http://www.rastersoft.com</a>
</pre>
  </body>
</html>