大网数据广告活动
服务器运维问答

sshuttle automate service runs with error

· 52CE 我爱测

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=alwa…

问题原文

原帖链接 · Mj Ebrahimzadeh · CC BY-SA 4.0

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

已采纳解答

原帖链接 · Mj Ebrahimzadeh · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-04-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。