首页 > 系统相关 >CentOS 7使用ttyd搭建一个WEB共享终端(WebSSH)

CentOS 7使用ttyd搭建一个WEB共享终端(WebSSH)

时间:2022-11-12 23:00:33浏览次数:68  
标签:WEB systemd ttyd CentOS systemctl https com bash

官网下载地址:​​https://github.com/tsl0922/ttyd/releases​


下载ttyd: wget -O ttyd ​​https://github.com/tsl0922/ttyd/releases/download/1.6.0/ttyd_linux.x86_64​

添加执行权限 chmod +x ttyd

移动目录 mv ttyd /usr/sbin

通过上面的几个步骤,我们已经完成ttyd安装

查看当前版本:ttyd -v

运行ttyd 命令: ttyd bash   ,然后浏览器访问http://IP:7681即可打开WEB终端


ttyd bash 创建后台运行服务,上面ttyd并没有保持后台运行,访问7681也不需要任何密码验证,非常不安全,接下来我们为ttyd创建一个systemd服务并设置用户名、密码验证。

创建一个ttyd.service文件:

vi /etc/systemd/system/ttyd.service内容如下:

[Unit]

Description=ttyd

After=network.target

[Service]

ExecStart=/usr/sbin/ttyd -c admin:admin bash

[Install]

WantedBy=multi-user.target

daemon生效,输入命令:systemctl daemon-reload


使用systemd命令来进行管理命令如下:

#启动ttyd systemctl start ttyd

#停止ttyd systemctl stop ttyd

#重启ttyd systemctl restart ttyd

#开机启动 systemctl enable ttyd


http://nieshouyuan.com/blog/20200308/2020-03-08-linux%20centos%20ttyd%E5%AE%89%E8%A3%85/
https://www.xiaoz.me/archives/14708
https://cloud.tencent.com/developer/article/2071990






标签:WEB,systemd,ttyd,CentOS,systemctl,https,com,bash
From: https://blog.51cto.com/feirenraoyuan/5846839

相关文章