<html>Dear Andrei,<br /><br />thank you very much, especially for the fast reply.<br /><br />The links gave very good information, unfortunately my version of systemd (< 250) does not support the command <pre><code>"systemd-creds" yet. But I found another solution...
I pipe the password to the program with the "echo" command. Not a good idea? YES, not a good idea!!!
But to solve the issue of plain text passwords in a script I compile the script with shc
</code><a href="https://en.wikipedia.org/wiki/Shc_(shell_script_compiler)">Shc (shell script compiler) - Wikipedia
</a>
I need to do that anyway, since bestcrypt expects keyfiles, and I need to hide the name/location of these files.
After compiling the script neither password nor keyfile information are visible any longer (in the binary).
</pre>Your answer:<br />What makes you think so? As is clearly visible in the service status,<br />the ExecStart command *did* run. Whether it also did what you expected<br />is another question.<br /><br />My answer/question:<br />Weird thing, after I made changes as above the script runs - successfully. Before I had the situation that it was NOT run.<br />Now I wonder, do services that do not run successfully become blacklisted (functionless) in any way? Difficult to explain here...<br /><br /><br /><br />Your answer:<br />These Wants and After are redundant, every standard service will be<br />ordered after local-fs.target unless it also has<br />DefaultDependencies=no.<br /><br />My answer/question:<br />I want my service to be run DIRECTLY (at first place) AFTER the local filesystems (in /etc/fstab) were mounted.<br /><br />Martin.<br /><br /><br />-- <br /><span style="font-family:Lucida Sans Unicode,Lucida Grande,sans-serif;"><strong>Martin Stenzel (马丁-斯坦泽尔)<br />An der Drehscheibe 9<br />50733 Köln<br />Deutschland</strong><br /><br /><br />-----BEGIN PGP PUBLIC KEY BLOCK-----<br /><br />mDMEZHjlmRYJKwYBBAHaRw8BAQdAEr/C08aStyKx+vztCxz4Nn8BHO2Lx0OXllsz<br />BP+ZEZm0Pk1hcnRpbiBTdGVuemVsIChDb2xvZ25lLCBHZXJtYW55KSA8bS5zdGVu<br />emVsQG1haWwueHktc3BhY2UuZGU+iJYEExYIAD4WIQQrzOhRsO0/8FaU5ykQoKMS<br />ax9FuAUCZHjlmQIbAwUJC0c1AAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAQ<br />oKMSax9FuNswAPsEsMp2JdzzDkAw6VzByp2XUY921lFt9rVoaVcZmjV5awD/W57o<br />a6c2qbD2p+AYkgKuffa2uZkX3mayvIxsfFnsWAW4OARkeOWZEgorBgEEAZdVAQUB<br />AQdAFlq+E22Hk7Gj44CCN4LDr97Y41lUGzvqmpCDpSq0CEwDAQgHiH4EGBYIACYW<br />IQQrzOhRsO0/8FaU5ykQoKMSax9FuAUCZHjlmQIbDAUJC0c1AAAKCRAQoKMSax9F<br />uGHVAQDjAisQxn5ADKIRPsMfFpE847jFJGA2lRafU7C30gLzhwD8DcegQwz7/RLc<br />yozIfQ6yIkz2cR3+NClIepnWV/ATQQw=<br />=qQIl<br />-----END PGP PUBLIC KEY BLOCK-----<br /><br />Fingerprint: 2BCC E851 B0ED 3FF0 5694 E729 10A0 A312 6B1F 45B8<br /><br /><br /><strong><span style="color:#000000;background-color:#ffffff;">This message was checked by ESET Endpoint Antivirus for Linux.</span><br /><br /><a href="https://www.eset.com">https://www.eset.com</a></strong></span><br /><br />On Monday, 07 August, 2023 11:04 CEST, Andrei Borzenkov <arvidjaar@gmail.com> wrote:<br /> <blockquote type="cite" cite="CAA91j0X_ddP281QcKR6TZv6_aACzW+kq8cZ__qoqrTR0TBrGzA@mail.gmail.com">On Mon, Aug 7, 2023 at 11:49 AM Martin Stenzel<br /><m.stenzel@mail.xy-space.de> wrote:<br />><br />><br />> Hi list,<br />> I searched the _whole_ www but did not find the answer.<br />><br />><br />><br />> I use bestcrypt <Encrypt Files with BestCrypt Container Encryption | Jetico> to mount the home directory.<br />><br />><br />> This is my service file.<br />><br />> --<br />> [Unit]<br />> Description=Mount Bestcrypt containers<br />> Wants=local-fs.target<br />> After=local-fs.target<br />><br /><br />These Wants and After are redundant, every standard service will be<br />ordered after local-fs.target unless it also has<br />DefaultDependencies=no.<br /><br />> [Service]<br />> Type=oneshot<br />> RemainAfterExit=true<br />> ExecStart=/usr/local/sbin/bcmount<br />> ExecStop=/usr/local/sbin/bceject<br />><br />> [Install]<br />> WantedBy=multi-user.target<br />> --<br />><br />> This is the file to be run<br />><br />> --<br />> #!/bin/sh<br />> /usr/bin/bctool mount /mnt/sdr2/2.jbc -t ext4 /mnt/el1-2_<br />><br />> exit 0<br />> --<br />><br />> If I run "bcmount" by hand (without systemd) it asks for a password, and this is very correct.<br />><br />> If I want to start with "systemctl start bcmount" nothing happens, no error, no execution of the program "bcmount", but as you can see:<br />><br />><br />> # systemctl status bestcrypt-fs<br />> ● bestcrypt-fs.service - Mount Bestcrypt containers<br />> Loaded: loaded (/etc/systemd/system/bestcrypt-fs.service; enabled; vendor preset: disabled)<br />> Active: active (exited) (thawing) since Mon 2023-08-07 11:17:18 EEST; 20min ago<br />> Process: 2645396 ExecStart=/usr/local/sbin/bcmount (code=exited, status=0/SUCCESS)<br />> Main PID: 2645396 (code=exited, status=0/SUCCESS)<br />><br />><br />> How come that the via "ExecStart=" given bash script does not get run?<br /><br />What makes you think so? As is clearly visible in the service status,<br />the ExecStart command *did* run. Whether it also did what you expected<br />is another question.<br /><br /><br /><br /><br />> This script does not contain any errors.<br />> The service file does not have any syntax errors either. Permissions to read/execute are verified!<br />><br />> Do you have a clue?<br /><br />If your program needs a password entered interactively, it cannot<br />request such a password using the "normal" way of reading from the<br />terminal. It would need to implement support for requesting the<br />password via password agents: https://systemd.io/PASSWORD_AGENTS/<br /><br />Why your program returns success status when it could not obtain the<br />necessary password is the question to your program.<br /><br />Internet most certainly has a lot of information about it. Like<br />https://unix.stackexchange.com/questions/391040/is-there-a-typical-way-to-pass-a-password-to-a-systemd-unit-file<br /><br />> I even changed "oneshot" into "simple", striked "RemainAfterExit", etc.<br />><br />> Is there any way I can see the whole process verbosely?<br />><br />><br />> Martin.<br />><br />><br />> --<br />> Martin Stenzel (马丁-斯坦泽尔)<br />> An der Drehscheibe 9<br />> 50733 Köln<br />> Deutschland<br />><br />><br />> -----BEGIN PGP PUBLIC KEY BLOCK-----<br />><br />> mDMEZHjlmRYJKwYBBAHaRw8BAQdAEr/C08aStyKx+vztCxz4Nn8BHO2Lx0OXllsz<br />> BP+ZEZm0Pk1hcnRpbiBTdGVuemVsIChDb2xvZ25lLCBHZXJtYW55KSA8bS5zdGVu<br />> emVsQG1haWwueHktc3BhY2UuZGU+iJYEExYIAD4WIQQrzOhRsO0/8FaU5ykQoKMS<br />> ax9FuAUCZHjlmQIbAwUJC0c1AAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAQ<br />> oKMSax9FuNswAPsEsMp2JdzzDkAw6VzByp2XUY921lFt9rVoaVcZmjV5awD/W57o<br />> a6c2qbD2p+AYkgKuffa2uZkX3mayvIxsfFnsWAW4OARkeOWZEgorBgEEAZdVAQUB<br />> AQdAFlq+E22Hk7Gj44CCN4LDr97Y41lUGzvqmpCDpSq0CEwDAQgHiH4EGBYIACYW<br />> IQQrzOhRsO0/8FaU5ykQoKMSax9FuAUCZHjlmQIbDAUJC0c1AAAKCRAQoKMSax9F<br />> uGHVAQDjAisQxn5ADKIRPsMfFpE847jFJGA2lRafU7C30gLzhwD8DcegQwz7/RLc<br />> yozIfQ6yIkz2cR3+NClIepnWV/ATQQw=<br />> =qQIl<br />> -----END PGP PUBLIC KEY BLOCK-----<br />><br />> Fingerprint: 2BCC E851 B0ED 3FF0 5694 E729 10A0 A312 6B1F 45B8<br />><br />><br />> This message was checked by ESET Endpoint Antivirus for Linux.<br />><br />> https://www.eset.com</blockquote></html>