GoTTY安裝:
首先需要安裝go語言>1.9環境, 如果是CentOS 7, 先要添加go-repo:
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
然後使用yum安裝golang:
yum install golang
執行下面的命令,它會從github下載並安裝GoTTY
go get github.com/yudai/gotty
安裝完成後,會在當前目錄下生成./go/bin/gotty
執行命令:
cd ./go/bin/
gotty -w -p 8081 --permit-arguments /bin/bash >/dev/null 2>&1 &
表示有可寫權限,頁面端口號爲8081,執行 /bin/bash命令,用於交互
執行後,訪問網頁:http://IP:8081,如我的IP爲http://172.20.102.20
則訪問http://172.20.102.20:8081