{"id":1485,"date":"2016-12-09T19:07:01","date_gmt":"2016-12-09T10:07:01","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=1485"},"modified":"2016-12-09T19:07:01","modified_gmt":"2016-12-09T10:07:01","slug":"ttyd-which-can-share-the-terminal-on-the-web","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2016\/12\/09\/ttyd-which-can-share-the-terminal-on-the-web\/","title":{"rendered":"\u7aef\u672b\u3092Web\u5171\u6709\u3067\u304d\u308bttyd"},"content":{"rendered":"<p><!--\ntitle:\u7aef\u672b\u3092Web\u5171\u6709\u3067\u304d\u308bttyd\n--><\/p>\n<p>\u7aef\u672b\u3092Web\u30d6\u30e9\u30a6\u30b6\u3067\u5171\u6709\u3067\u304d\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a8\u30a2\u3067\u3059\uff0e \u4ee5\u524d\u4f3c\u305f\u3082\u306e\u3067GoTTY\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u304c\uff0cttyd\u306fGoTTY\u30a4\u30f3\u30b9\u30d1\u30a4\u30a2\u3089\u3057\u3044\u3067\u3059\uff0e ttyd\u306fc\u88fd\u3067MIT\u30e9\u30a4\u30bb\u30f3\u30b9\u3067\u3059\uff0e<\/p>\n<ul>\n<li><a href=\"https:\/\/tsl0922.github.io\/ttyd\/\" title=\"ttyd - Share your terminal over the web\">ttyd &#8211; Share your terminal over the web<\/a><\/li>\n<\/ul>\n<h2 id=\"\u5c0e\u5165\">\u5c0e\u5165<\/h2>\n<p>\u4eca\u56de\u306fDebian stretch amd64(testing)\u306b\u5c0e\u5165\u3057\u307e\u3057\u305f\uff0e <code>README.md<\/code>\u3067\u306fUbuntu 16.04\u3067\u306e\u624b\u9806\u304c\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u304c\u305d\u306e\u307e\u307e\u4f7f\u3048\u307e\u3057\u305f\uff0e<\/p>\n<pre><code>$ sudo apt install cmake g++ pkg-config git vim-common libwebsockets-dev libjson-c-dev libssl-dev\r\n$ git clone https:\/\/github.com\/tsl0922\/ttyd.git\r\n$ cd ttyd\r\n$ mkdir build\r\n$ cd build\r\n$ cmake ..\r\n$ make<\/code><\/pre>\n<h2 id=\"\u52d5\u304b\u3057\u3066\u307f\u308b\">\u52d5\u304b\u3057\u3066\u307f\u308b<\/h2>\n<pre><code>$ .\/ttyd -p 8080 bash<\/code><\/pre>\n<p>\u3068\u3057\u3066\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3067 <code>http:\/\/localhost:8080\/<\/code> \u306b\u7e4b\u3050\u3068\u5229\u7528\u3067\u304d\u307e\u3059\uff0e tmux\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u5171\u6709\u3057\u3066\u8907\u6570\u306e\u30d6\u30e9\u30a6\u30b6\u30671\u3064\u306e\u7aef\u672b\u306e\u64cd\u4f5c\u3068\u304bdocker\u5229\u7528\u3068\u304bGoTTY\u3068\u540c\u3058\u3088\u3046\u306b\u5229\u7528\u3067\u304d\u307e\u3059\uff0e<\/p>\n<pre><code>$ .\/ttyd -p 8080 tmux new -A -s ttyd\r\n[2016\/12\/09 18:54:25:5954] NOTICE: Initial logging level 7\r\n[2016\/12\/09 18:54:25:5954] NOTICE: Libwebsockets version: 2.0.3 unknown-build-hash\r\n[2016\/12\/09 18:54:25:5954] NOTICE: IPV6 not compiled in\r\n[2016\/12\/09 18:54:25:5954] NOTICE: libev support compiled in but disabled\r\n[2016\/12\/09 18:54:25:5954] NOTICE: libuv support compiled in but disabled\r\n[2016\/12\/09 18:54:25:5955] NOTICE:  Threads: 1 each 1024 fds\r\n[2016\/12\/09 18:54:25:5955] NOTICE:  mem: platform fd map:  8192 bytes\r\n[2016\/12\/09 18:54:25:5955] NOTICE:  Compiled with OpenSSL support\r\n[2016\/12\/09 18:54:25:5955] NOTICE:  SSL disabled: no LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT\r\n[2016\/12\/09 18:54:25:5955] NOTICE: Creating Vhost &#39;default&#39; port 8080, 2 protocols\r\n[2016\/12\/09 18:54:25:5955] NOTICE:  Listening on port 8080\r\n[2016\/12\/09 18:54:25:5955] NOTICE:  mem: per-conn:          920 bytes + protocol rx buf\r\n[2016\/12\/09 18:54:25:5956] NOTICE:  canonical_hostname = x220\r\n[2016\/12\/09 18:54:25:5956] NOTICE: TTY configuration:\r\n[2016\/12\/09 18:54:25:5956] NOTICE:   start command: tmux new -A -s ttyd\r\n[2016\/12\/09 18:54:25:5956] NOTICE:   reconnect timeout: 10s\r\n[2016\/12\/09 18:54:25:5956] NOTICE:   close signal: SIGHUP (1)\r\n[2016\/12\/09 18:54:25:6057] NOTICE: lws_protocol_init\r\n[2016\/12\/09 18:54:25:9806] NOTICE: HTTP connect from localhost (127.0.0.1), path: \/\r\n[2016\/12\/09 18:54:25:0015] NOTICE: HTTP connect from localhost (127.0.0.1), path: \/auth_token.js\r\n[2016\/12\/09 18:54:26:3474] NOTICE: client connected from localhost (127.0.0.1), total: 1\r\n[2016\/12\/09 18:54:26:3548] NOTICE: started process, pid: 30365\r\n[2016\/12\/09 18:54:34:2928] NOTICE: HTTP connect from localhost (127.0.0.1), path: \/\r\n[2016\/12\/09 18:54:34:3132] NOTICE: error on reading from skt : 104\r\n[2016\/12\/09 18:54:34:3132] NOTICE: sending SIGHUP to process 30365\r\n[2016\/12\/09 18:54:34:3138] NOTICE: process exited with code 256, pid: 30365\r\n[2016\/12\/09 18:54:34:3138] NOTICE: client disconnected from localhost (127.0.0.1), total: 0\r\n[2016\/12\/09 18:54:34:5554] NOTICE: HTTP connect from localhost (127.0.0.1), path: \/auth_token.js\r\n[2016\/12\/09 18:54:34:5732] NOTICE: client connected from localhost (127.0.0.1), total: 1\r\n[2016\/12\/09 18:54:34:5811] NOTICE: started process, pid: 30505\r\n[2016\/12\/09 18:54:40:0073] NOTICE: wsi 0x556bcbc34500: TIMEDOUT WAITING on 3 (did hdr 0, ah 0x556bcbbc0c50, wl 0, pfd events 0)\r\n[2016\/12\/09 18:54:40:0074] NOTICE: lws_header_table_detach: wsi 0x556bcbc34500: ah held 6s, ah.rxpos 0, ah.rxlen 0, mode\/state 0 4,wsi-&gt;more_rx_waiting 0<\/code><\/pre>\n<p><a data-flickr-embed=\"true\"  href=\"https:\/\/www.flickr.com\/photos\/119142834@N05\/31526345375\" title=\"20161209_18:12:56-1180\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/c8.staticflickr.com\/1\/509\/31526345375_06da4a1cf5.jpg\" width=\"500\" height=\"330\" alt=\"20161209_18:12:56-1180\"><\/a><script async src=\"\/\/embedr.flickr.com\/assets\/client-code.js\" charset=\"utf-8\"><\/script><\/p>\n<p>GoTTY\u306b\u3064\u3044\u3066\u306f\u3053\u3061\u3089\u3092\uff0e<\/p>\n<ul>\n<li><a href=\"https:\/\/matoken.org\/blog\/blog\/2015\/08\/24\/terminal-web-share-gotty\/\" title=\"\u7aef\u672b\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b Web \u3067\u5171\u6709\u3067\u304d\u308b GoTTY | matoken&#39;s meme\">\u7aef\u672b\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b Web \u3067\u5171\u6709\u3067\u304d\u308b GoTTY | matoken&#8217;s meme<\/a><\/li>\n<\/ul>\n<p><iframe loading=\"lazy\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/dnNhjGWtxZwodE#6\" width=\"595\" height=\"485\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen><br \/>\n<\/iframe><br \/>\n<strong> <a href=\"\/\/www.slideshare.net\/matoken\/2-rasbian-jessie-google-authenticator#6\" title=\"\u52c9\u5f37\u4f1a\u5411\u3051\u30b5\u30fc\u30d0\u3092\u4f5c\u3063\u3066\u307f\u308b2 \/ Rasbian jessie\u3092\u8a66\u3059\/ Google Authenticator\u306e\u30d1\u30b9\u30b3\u30fc\u30c9\u3092\u4f5c\u308b\" target=\"_blank\">\u52c9\u5f37\u4f1a\u5411\u3051\u30b5\u30fc\u30d0\u3092\u4f5c\u3063\u3066\u307f\u308b2 \/ Rasbian jessie\u3092\u8a66\u3059\/ Google Authenticator\u306e\u30d1\u30b9\u30b3\u30fc\u30c9\u3092\u4f5c\u308b<\/a> <\/strong> from <strong><a target=\"_blank\" href=\"\/\/www.slideshare.net\/matoken\">Kenichiro MATOHARA<\/a><\/strong><\/p>\n<p><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B01MG83EFG&#038;linkId=d8910940f17588011bcbc206989d2a0c\"><\/iframe><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B00TQMFOCW&#038;linkId=259da287e15647f3cb2062495756da2d\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7aef\u672b\u3092Web\u30d6\u30e9\u30a6\u30b6\u3067\u5171\u6709\u3067\u304d\u308b\u30bd\u30d5\u30c8\u30a6\u30a7\u30a8\u30a2\u3067\u3059\uff0e \u4ee5\u524d\u4f3c\u305f\u3082\u306e\u3067GoTTY\u3092\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u304c\uff0cttyd\u306fGoTTY\u30a4\u30f3\u30b9\u30d1\u30a4\u30a2\u3089\u3057\u3044\u3067\u3059\uff0e ttyd\u306fc\u88fd\u3067MIT\u30e9\u30a4\u30bb\u30f3\u30b9\u3067\u3059\uff0e ttyd &#8211; Share [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[7,6,75,90],"tags":[186,275,185],"class_list":["post-1485","post","type-post","status-publish","format-standard","hentry","category-debian-linux","category-linux","category-stretch","category-testing","tag-gotty","tag-linux","tag-ttyd"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/1485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=1485"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/1485\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=1485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=1485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=1485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}