How to create / delete $XDG_RUNTIME_DIR at login / logoff

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Today I was surprised to ssh into my box running Arch Linux and find that /run/user/$(id -u) didn't exist.



The XDG Base Directory Specification says:




$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.



The lifetime of the directory MUST be bound to the user being logged in. It MUST be created when the user first logs in and if the user fully logs out the directory MUST be removed. If the user logs in more than once he should get pointed to the same directory, and it is mandatory that the directory continues to exist from his first login to his last logout on the system, and not removed in between. Files in the directory MUST not survive reboot or a full logout/login cycle.




On a systemd box, is /run/user/$(id -u) the preferred place for $XDG_RUNTIME_DIR (even if it needs to be created?)



If not, what's best practice for creating $XDG_RUNTIME_DIR?



How do I ensure that that the directory is deleted only when I have "fully" logged out?



(Does "fully" mean that mean all processes created by login shells have exited? How to check for that?)









share

























    up vote
    0
    down vote

    favorite












    Today I was surprised to ssh into my box running Arch Linux and find that /run/user/$(id -u) didn't exist.



    The XDG Base Directory Specification says:




    $XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.



    The lifetime of the directory MUST be bound to the user being logged in. It MUST be created when the user first logs in and if the user fully logs out the directory MUST be removed. If the user logs in more than once he should get pointed to the same directory, and it is mandatory that the directory continues to exist from his first login to his last logout on the system, and not removed in between. Files in the directory MUST not survive reboot or a full logout/login cycle.




    On a systemd box, is /run/user/$(id -u) the preferred place for $XDG_RUNTIME_DIR (even if it needs to be created?)



    If not, what's best practice for creating $XDG_RUNTIME_DIR?



    How do I ensure that that the directory is deleted only when I have "fully" logged out?



    (Does "fully" mean that mean all processes created by login shells have exited? How to check for that?)









    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Today I was surprised to ssh into my box running Arch Linux and find that /run/user/$(id -u) didn't exist.



      The XDG Base Directory Specification says:




      $XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.



      The lifetime of the directory MUST be bound to the user being logged in. It MUST be created when the user first logs in and if the user fully logs out the directory MUST be removed. If the user logs in more than once he should get pointed to the same directory, and it is mandatory that the directory continues to exist from his first login to his last logout on the system, and not removed in between. Files in the directory MUST not survive reboot or a full logout/login cycle.




      On a systemd box, is /run/user/$(id -u) the preferred place for $XDG_RUNTIME_DIR (even if it needs to be created?)



      If not, what's best practice for creating $XDG_RUNTIME_DIR?



      How do I ensure that that the directory is deleted only when I have "fully" logged out?



      (Does "fully" mean that mean all processes created by login shells have exited? How to check for that?)









      share













      Today I was surprised to ssh into my box running Arch Linux and find that /run/user/$(id -u) didn't exist.



      The XDG Base Directory Specification says:




      $XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.



      The lifetime of the directory MUST be bound to the user being logged in. It MUST be created when the user first logs in and if the user fully logs out the directory MUST be removed. If the user logs in more than once he should get pointed to the same directory, and it is mandatory that the directory continues to exist from his first login to his last logout on the system, and not removed in between. Files in the directory MUST not survive reboot or a full logout/login cycle.




      On a systemd box, is /run/user/$(id -u) the preferred place for $XDG_RUNTIME_DIR (even if it needs to be created?)



      If not, what's best practice for creating $XDG_RUNTIME_DIR?



      How do I ensure that that the directory is deleted only when I have "fully" logged out?



      (Does "fully" mean that mean all processes created by login shells have exited? How to check for that?)







      systemd tmp tmpfs xdg xdg-user-dirs





      share












      share










      share



      share










      asked 7 mins ago









      Tom Hale

      6,11522780




      6,11522780

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476963%2fhow-to-create-delete-xdg-runtime-dir-at-login-logoff%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476963%2fhow-to-create-delete-xdg-runtime-dir-at-login-logoff%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay