Score:1

sshuttle automate service runs with error

br flag

I have written a service as it was given in this question but when I run the service I get only error in status.

service:

GNU nano 6.2 /etc/systemd/system/sshuttle.service
[Unit] Description=sshuttle tunnel

[Service]
Restart=always
User=user
Group=user
ExecStart=/usr/bin/sshuttle -vr my-ip 0/0 -x my-ip/32 --ssh-cmd 'ssh -i ~/server.pem'

[Install]
WantedBy=multi-user.target

error I get in status:

× sshuttle.service - sshuttle tunnel
     Loaded: loaded (/etc/systemd/system/sshuttle.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2023-04-02 11:12:09 +0330; 1s ago
    Process: 2142 ExecStart=/usr/bin/sshuttle -vr my-ip 0/0 -x my-ip/32 --ssh-cmd ssh -i ~/server.pem (code=exited, status=217/USER)
   Main PID: 2142 (code=exited, status=217/USER)
        CPU: 1ms

Apr 02 11:12:09 mj-virtual-machine systemd[1]: sshuttle.service: Scheduled restart job, restart counter is at 5.
Apr 02 11:12:09 mj-virtual-machine systemd[1]: Stopped sshuttle tunnel.
Apr 02 11:12:09 mj-virtual-machine systemd[1]: sshuttle.service: Start request repeated too quickly.
Apr 02 11:12:09 mj-virtual-machine systemd[1]: sshuttle.service: Failed with result 'exit-code'.
Apr 02 11:12:09 mj-virtual-machine systemd[1]: Failed to start sshuttle tunnel.

updated config:

[Unit]
Description=sshuttle tunnel

[Service]
Restart=always
ExecStart=/usr/bin/sshuttle -vr ssh-user@ssh-ip 0/0 -x ssh-ip/32 --ssh-cmd 'ssh -i /home/mj/server.pem'

[Install]
WantedBy=multi-user.target

Score:1
by flag

There is some problem in your config like the ~ in --ssh-cmd option.

First here is your updated ExecStart ExecStart=/usr/bin/sshuttle -vr my-ip 0/0 -x my-ip/32 --ssh-cmd 'ssh -i /home/user/server.pem' then reload your service sudo systemctl daemon-reload then we enable and start the service

sudo systemctl enable sshuttle.service
sudo systemctl start sshuttle.service

edit:

It might be a problem with the user, be sure to use the correct one in the file below:

[Unit]
Description=sshuttle tunnel

[Service]
Restart=always
User=<your_username>
Group=<your_groupname>
ExecStart=/usr/bin/sshuttle -vr ssh-user@ssh-ip 0/0 -x ssh-ip/32 --ssh-cmd 'ssh -i /home/<your_username>/server.pem'

[Install]
WantedBy=multi-user.target
Mj Ebrahimzadeh avatar
br flag
still have the same error. I have updated the config
Mj Ebrahimzadeh avatar
br flag
just changed my config, its trying to connect but gives `Host key verification failed.` error
Saxtheowl avatar
by flag
I have updated my answer maybe it will fix your problem
Mj Ebrahimzadeh avatar
br flag
When I add user and group, it gives same error but when I don't it says `Host key verification failed.`
Score:1
br flag

I found the solution thanks to Saxtheowl

this is my final config and its working fine:

[Unit]
Description=sshuttle tunnel

[Service]
Restart=always
ExecStart=/bin/bash -c "/usr/bin/sshuttle --dns -vr ssh-user@ssh-ip 0/0 -x ssh-ip/32 --ssh-cmd '/usr/bin/ssh -i /home/ubuntu-user/server.pem -o StrictHostKeyChecking=no'"

[Install]
WantedBy=multi-user.target
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.