{"id":902,"date":"2015-08-24T06:31:05","date_gmt":"2015-08-23T21:31:05","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=902"},"modified":"2015-08-24T06:32:35","modified_gmt":"2015-08-23T21:32:35","slug":"terminal-web-share-gotty","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2015\/08\/24\/terminal-web-share-gotty\/","title":{"rendered":"\u7aef\u672b\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b Web \u3067\u5171\u6709\u3067\u304d\u308b GoTTY"},"content":{"rendered":"<ul>\n<li><a href=\"https:\/\/github.com\/yudai\/gotty\">yudai\/gotty<\/a>\n<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3067\u3060\u3044\u305f\u3044\u89e3\u308b\u3068\u601d\u3044\u307e\u3059\u304c\uff0c\u7aef\u672b\u3092 Web\u30d6\u30e9\u30a6\u30b6\u3067\u516c\u958b\u3059\u308b\u3053\u3068\u306e\u3067\u304d\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3059\uff0eGo \u3067\u66f8\u304b\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3059\uff0e<br \/><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/yudai\/gotty\/master\/screenshot.gif\" alt=\"\"><\/p>\n<p>\u7aef\u672b\u306e\u5185\u5bb9\u3092\u516c\u958b\u3059\u308b\u3060\u3051\u3067\u306a\u304f\uff0c <code>-w<\/code> \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u308b\u3068\u5165\u529b\u3067\u3082\u3067\u304d\u308b\u306e\u3067\u666e\u901a\u306b\u7aef\u672b\u64cd\u4f5c\u304c Web\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u53ef\u80fd\u3067\u3059\uff0e<\/p>\n<h2 id=\"\u5c0e\u5165\u4f8b\"><a name=\"\u5c0e\u5165\u4f8b\" href=\"#\u5c0e\u5165\u4f8b\"><\/a>\u5c0e\u5165\u4f8b<\/h2>\n<p><code>~\/usr\/local\/go<\/code> \u4ee5\u4e0b\u306b\u5c0e\u5165\u3057\u3066\u3044\u308b\uff0e<\/p>\n<pre><code>% GOPATH=~\/usr\/local\/go go get github.com\/yudai\/gotty\r\n% ~\/usr\/local\/go\/bin\/gotty top\r\n<\/code><\/pre>\n<p>\u3053\u306e\u72b6\u614b\u3067 <a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a> \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u308b\u3068 <code>top<\/code> \u30b3\u30de\u30f3\u30c9\u304c\u8868\u793a\u3055\u308c\u307e\u3059\uff0e\u8272\u3005\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u304c\uff0c Nyancat \u306f\u9045\u5ef6\u306a\u304f\u52d5\u304d\u307e\u3057\u305f\u304c\uff0ccacademo \u306f\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\uff0e\u30d6\u30e9\u30a6\u30b6\u306f Chromium \/ midori \u3092\u8a66\u3057\u307e\u3057\u305f\u304c\u3069\u3061\u3089\u3082\u5909\u308f\u3089\u305a\u52d5\u3044\u3066\u3044\u308b\u3088\u3046\u3067\u3059\uff0e<\/p>\n<p><code>gotty bash<\/code> \u3068\u304b\u3059\u308c\u3070\u307f\u3093\u306a\u3067\u3072\u3068\u3064\u306e\u7aef\u672b\u3092\u89e6\u308c\u308b\u306e\u304b\u306a?\u3068\u601d\u3063\u305f\u306e\u3067\u3059\u304c\uff0c\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3054\u3068\u306b\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u4f5c\u3089\u308c\u308b\u3088\u3046\u3067\u3046\u307e\u304f\u3044\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff0e<\/p>\n<pre><code>2015\/08\/23 14:47:42 Server is starting with command: bash\r\n2015\/08\/23 14:47:46 New client connected: 127.0.0.1:36194\r\n2015\/08\/23 14:47:46 Command is running for client 127.0.0.1:36194 with PID 28469\r\n2015\/08\/23 14:48:56 New client connected: 127.0.0.1:36208\r\n2015\/08\/23 14:48:56 Command is running for client 127.0.0.1:36208 with PID 29315\r\n<\/code><\/pre>\n<p>README.md \u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\uff0c<\/p>\n<pre><code>Sharing with Multiple Clients\r\n\r\nGotty starts a new process when a new client connects to the server. This means users cannot share a single terminal with others by default. However, you can use terminal multiplexers for sharing a single process with multiple clients.\r\n\r\nFor example, you can start a new tmux session named gotty with top command by the command below.\r\n\r\n$ gotty tmux new -A -s gotty top\r\nThis command doesn&#39;t allow clients to send keystrokes, however, you can attach the session from your local terminal and run operations like switching the mode of the top command. To connect to the tmux session from your terminal, you can use following command.\r\n\r\n$ tmux new -A -s gotty\r\nBy using terminal multiplexers, you can have the control of your terminal and allow clients to just see your screen.\r\n<\/code><\/pre>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067 <code>gotty tmux new -A -s gotty<\/code> \u3067\u5b9f\u73fe\u3067\u304d\u307e\u3057\u305f\uff0eGNU Screen \u3067\u3082\u51fa\u6765\u306a\u3044\u304b\u3068\u30bb\u30c3\u30b7\u30e7\u30f3\u540d\u3092\u540c\u3058\u3088\u3046\u306b <code>gotty<\/code> \u306b\u3057\u3066 <code>multiuser on<\/code> \u306b\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3053\u308c\u3060\u3051\u3067\u306f\u3046\u307e\u304f\u884c\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff0eGoTTY \u672c\u4f53\u306b\u624b\u3092\u5165\u308c\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e<\/p>\n<p>\u305f\u3060\uff0c\u4f55\u3082\u8003\u3048\u305a\u306b\u4f7f\u3046\u3068\u30d7\u30ed\u30c8\u30b3\u30eb\u306f http \u306a\u306e\u3067\u76d7\u307f\u898b\u3082\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3057\u8ab0\u3067\u3082\u64cd\u4f5c\u3067\u304d\u308b\u3057\u3067\u5371\u967a\u3067\u3059\uff0e\u4e00\u5fdc\u30e9\u30f3\u30c0\u30e0URL \u3084 Bashic AUTH \u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u3042\u308a\u307e\u3059\u304c\u5341\u5206\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\uff0e<\/p>\n<p>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u306f\uff0cDocker \u3092\u5229\u7528\u3059\u308b\u4f8b\u304c\u8f09\u3063\u3066\u3044\u307e\u3059\uff0e<\/p>\n<pre><code>Playing with Docker\r\n\r\nWhen you want to create a jailed environment for each client, you can use Docker containers like following:\r\n\r\n$ gotty -w docker run -it --rm busybox\r\n<\/code><\/pre>\n<p>Fw \u306e\u5185\u5074\u3067\u793e\u5185\u3084\uff0c\u52c9\u5f37\u4f1a\u306a\u3069\u306e\u5185\u8f2a\u3067\u4e00\u6642\u7684\u306b\u516c\u958b\u3057\u3066\u516c\u958b\u5f8c\u306f\u30a4\u30e1\u30fc\u30b8\u3092\u7834\u68c4\u3059\u308b\u304f\u3089\u3044\u304c\u826f\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e<\/p>\n<p>\u305d\u3046\u3044\u3048\u3070\u52c9\u5f37\u4f1a\u30b5\u30fc\u30d0\u3082\u4f5c\u3063\u3066\u3044\u305f\u306e\u3067\u3057\u305f\uff0eGoTTY \u3082\u5165\u308c\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\uff0e<\/p>\n<p><iframe loading=\"lazy\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/vPivD9Zq1Befvh\/#12\" width=\"425\" height=\"355\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" style=\"border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;\" allowfullscreen> <\/iframe> <\/p>\n<div style=\"margin-bottom:5px\"> <strong> <a href=\"\/\/www.slideshare.net\/matoken\/ss-51975843\/#12\" title=\"\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30ab\u30f3\u30d5\u30a1\u30ec\u30f3\u30b9\u5927\u5206\u53c2\u52a0\u5831\u544a &amp; \u52c9\u5f37\u4f1a\u5411\u3051\u30b5\u30fc\u30d0\u3092\u4f5c\u3063\u3066\u307f\u308b\" target=\"_blank\">\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30ab\u30f3\u30d5\u30a1\u30ec\u30f3\u30b9\u5927\u5206\u53c2\u52a0\u5831\u544a &amp; \u52c9\u5f37\u4f1a\u5411\u3051\u30b5\u30fc\u30d0\u3092\u4f5c\u3063\u3066\u307f\u308b<\/a> <\/strong> from <strong><a href=\"\/\/www.slideshare.net\/matoken\" target=\"_blank\">Kenichiro MATOHARA<\/a><\/strong> <\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>yudai\/gotty \u4ee5\u4e0b\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3067\u3060\u3044\u305f\u3044\u89e3\u308b\u3068\u601d\u3044\u307e\u3059\u304c\uff0c\u7aef\u672b\u3092 Web\u30d6\u30e9\u30a6\u30b6\u3067\u516c\u958b\u3059\u308b\u3053\u3068\u306e\u3067\u304d\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3059\uff0eGo \u3067\u66f8\u304b\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3059\uff0e \u7aef\u672b\u306e\u5185\u5bb9\u3092\u516c\u958b\u3059\u308b\u3060\u3051\u3067\u306a\u304f\uff0c -w \u30aa\u30d7\u30b7\u30e7\u30f3 [&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":[],"tags":[289],"class_list":["post-902","post","type-post","status-publish","format-standard","hentry","tag-oss"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/902","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=902"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/902\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}