Starting ssh from a systemd service

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I cannot start the 'ssh' command from a systemd service. A very simple service file demonstrates the problem:


# /run/systemd/system/ssh-test.service

[Unit]

[Service]
Type = oneshot
ExecStart = /usr/bin/ssh -V


[root@raspi-400 ~]# systemctl start ssh-test.service
Job for ssh-test.service failed because the control process exited with error code. See "systemctl status ssh-test.service" and "journalctl -xeu ssh-test.service" for details.
[root@raspi-400 ~]# systemctl status ssh-test.service
× ssh-test.service
     Loaded: loaded (/run/systemd/system/ssh-test.service; static)
     Active: failed (Result: exit-code) since Tue 2023-02-14 23:26:47 CET; 8s ago
    Process: 11787 ExecStart=/usr/bin/ssh -V (code=exited, status=203/EXEC)
   Main PID: 11787 (code=exited, status=203/EXEC)
        CPU: 3ms

Feb 14 23:26:47 raspi-400 systemd[11787]: ssh-test.service: Failed at step EXEC spawning /usr/bin/ssh: Permission denied
Feb 14 23:26:47 raspi-400 systemd[1]: Starting ssh-test.service...
Feb 14 23:26:47 raspi-400 systemd[1]: ssh-test.service: Main process exited, code=exited, status=203/EXEC Feb 14 23:26:47 raspi-400 systemd[1]: ssh-test.service: Failed with result 'exit-code'.
Feb 14 23:26:47 raspi-400 systemd[1]: Failed to start ssh-test.service.


Running the ssh command from the shell prompt works just fine:

[root@raspi-400 ~]# /usr/bin/ssh -V
OpenSSH_8.8p1, OpenSSL 3.0.8 7 Feb 2023






[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux