Notion Blog
技术分享1 分钟阅读

pyhton web端ssh终端webssh安装使用

webssh一个简单的web应用程序,用作连接到ssh服务器的ssh客户端。它是用Python编写的,基于tornado, paramiko和xterm.js。

安装

pip install webssh

启动命令

前提是Python的bin目录添加进环境变量,或者使用Python目录+/bin/wssh运行

wssh

访问页面:127.0.0.1:8888

访问如果出现403,需要启用 SSL,开启https访问

也可以在启动命令中关闭

wssh --fbidhttp=False

如果你想把他iframe嵌入到自己的项目中,需要关闭xsrf

wssh --fbidhttp=False  --xsrf=False

默认提供的页面的确不是很好看,你想跳过填写他的页面可用拼接链接访问

(密码必须以 base64 编码)

http://localhost:8888/?hostname=xx&username=yy&password=str_base64_encoded&port=22

官方文档还提供了更多的

传递终端背景色

http://localhost:8888/#bgcolor=green

传递终端字体颜色

http://localhost:8888/#fontcolor=red

传递用户定义的标题

http://localhost:8888/?title=my-ssh-server

传递编码

http://localhost:8888/#encoding=gbk

传递字体大小

http://localhost:8888/#fontsize=24

传递登录后立即执行的命令

http://localhost:8888/?command=pwd

传递终端类型

http://localhost:8888/?term=xterm-256color
有关使用上的问题,欢迎您在底部评论区留言,一起交流~

读者评论

评论会同步写入该文在 Notion 中的页面底部(与正文同页,便于管理)。

0/1500

暂无评论,欢迎抢沙发。