On 12/28/24 19:12, Bruno Barbier wrote:
If you use a session (org babel), Org will make an interactive session (bash), and bash will read the '.bashrc'. Using heading properties, you could do something like: * your heading :PROPERTIES: :header-args:shell: :dir /ssh:user@remotesrv|sudo:serviceuser@remotesrv: :header-args:shell+: :session "!sh serviceuser" :END: #+begin_src shell systemctl --user daemon-reload #+end_src #+begin_src shell an other command #+end_src Without a session, Org is executing the code in a non-interactive way (bash -c), and the ".bashrc" file isn't loaded.
Adding the :session option allowed the remote shell to maintain the environment variables, including XDG_RUNTIME_DIR, as expected.
Thank you once again for advice and I appreciate your support. Best regards, bartk