让autossh随系统自动启动

可以使用systemd来让autossh自动启动,这样即使服务器重启后依然可以访问。

参考:https://pesin.space/posts/2020-10-16-autossh-systemd/ https://gist.github.com/thomasfr/9707568

具体:在/etc/systemd/system/目录下建立一个autossh.service文件,其内容如下:

cat autossh.service 

[Unit]
Description=AutoSSH tunnel service on local port 7192
After=network.target


[Service]
Environment=”AUTOSSH_GATETIME=0″
ExecStart=/usr/bin/autossh -M 0 -o “ServerAliveInterval 50” -o “ServerAliveCountMax 5” -o ExitOnForwardFailure=yes -i /home/user/.ssh/id_rsa -gCNR 7192:localhost:22 user@remote_host


[Install]
WantedBy=multi-user.target

已发布

分类

来自

标签:

评论

《 “让autossh随系统自动启动” 》 有 10 条评论

  1. hello world

    hello world

  2. tadalafil kaufen

    tadalafil kaufen

  3. larotid

    larotid

  4. mobic medication 15 mg

    mobic medication 15 mg

  5. zoloft generic 50 mg

    zoloft generic 50 mg

  6. clozaril

    clozaril

  7. sildenafil dosage sizes

    sildenafil dosage sizes

  8. tadalafil 2.5 daily

    tadalafil 2.5 daily

  9. cenforce 200 tablet uses

    cenforce 200 tablet uses

  10. xenical or alli

    xenical or alli

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注