{"id":13113,"date":"2019-04-01T01:17:14","date_gmt":"2019-04-01T01:17:14","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13113"},"modified":"2019-04-01T01:17:14","modified_gmt":"2019-04-01T01:17:14","slug":"how-to-host-multiple-linux-terminals-for-viewing-and-collaboration-with-wemux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-host-multiple-linux-terminals-for-viewing-and-collaboration-with-wemux\/","title":{"rendered":"How to Host Multiple Linux Terminals for Viewing and Collaboration with Wemux"},"content":{"rendered":"<p>Now we will introduce you to\u00a0<strong>wemux<\/strong>\u00a0(a multi-user version of\u00a0<strong>tmux<\/strong>), which not only includes the features provided by\u00a0<strong>tmux<\/strong>, but also allows users to host a multi-terminal environment where clients can join in viewing or collaborative mode.<\/p>\n<div id=\"attachment_18087\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/Wemux-View-Remote-Linux-Terminal-Session.png\" rel=\"attachment wp-att-18087\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-18087\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/Wemux-View-Remote-Linux-Terminal-Session.png\" sizes=\"auto, (max-width: 893px) 100vw, 893px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/Wemux-View-Remote-Linux-Terminal-Session.png 893w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/Wemux-View-Remote-Linux-Terminal-Session-768x394.png 768w\" alt=\"Wemux View Remote Linux Terminal Session\" width=\"893\" height=\"458\" aria-describedby=\"caption-attachment-18087\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-18087\" class=\"wp-caption-text\">Wemux View Remote Linux Terminal Session<\/p>\n<\/div>\n<p>In other words, you can host a session where others can view what you do in the terminal (to perform a demonstration, for example), or to collaborate with them.<\/p>\n<p>To help you get the most of\u00a0<strong>wemux<\/strong>, I highly recommend you take a look at the previous guide about tmux before going through the present article.<\/p>\n<h3>Installing and Configuring Wemux Multi-User Terminal<\/h3>\n<p>As a prerequisite before installing\u00a0<strong>wemux<\/strong>, we will use\u00a0<a href=\"https:\/\/www.tecmint.com\/install-git-to-create-and-share-your-own-projects-on-github-repository\/\" target=\"_blank\" rel=\"noopener\">git to clone the project\u2019s repository<\/a>\u00a0in our local system. If the following command shows that\u00a0<strong>git<\/strong>\u00a0is not found in your system:<\/p>\n<pre># which git \r\n<\/pre>\n<p>as indicated by:<\/p>\n<pre>\/usr\/bin\/which: no git in (\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin) \r\n<\/pre>\n<p>Install it before proceeding (use\u00a0<strong>yum<\/strong>\u00a0or\u00a0<strong>aptitude<\/strong>\u00a0depending on your distribution):<\/p>\n<pre># yum install git       [On <strong>RedHat<\/strong> based systems] \r\n# dnf install git       [On <strong>Fedora 22+<\/strong> versions]\r\n# aptitude install git  [On <strong>Debian<\/strong> based systems]\r\n<\/pre>\n<p>Then,<\/p>\n<p><strong>1.<\/strong>\u00a0Clone the remote repository.<\/p>\n<pre># git clone git:\/\/github.com\/zolrath\/wemux.git \/usr\/local\/share\/wemux \r\n<\/pre>\n<p><strong>2.<\/strong>\u00a0Create a symbolic link to the\u00a0<strong>wemux<\/strong>\u00a0executable inside\u00a0<code>\/usr\/local\/bin<\/code>\u00a0or another directory in your\u00a0<strong>$PATH<\/strong>variable.<\/p>\n<pre># ln -s \/usr\/local\/share\/wemux\/wemux \/usr\/local\/bin\/wemux \r\n<\/pre>\n<p><strong>3.<\/strong>\u00a0Copy the configuration sample configuration file into\u00a0<code>\/usr\/local\/etc<\/code>.<\/p>\n<pre># cp \/usr\/local\/share\/wemux\/wemux.conf.example \/usr\/local\/etc\/wemux.conf \r\n<\/pre>\n<p>And insert the following line:<\/p>\n<pre>host_list=(user1 user2 user3) \r\n<\/pre>\n<p>where\u00a0<code>user1<\/code>,\u00a0<code>user2<\/code>, and\u00a0<code>user3<\/code>\u00a0are users who are allowed to start\u00a0<strong>wemux<\/strong>\u00a0servers. You can add as many users as needed separated by spaces. Other users will be able to connect to a running wemux server but will not be allowed to start one.<\/p>\n<h3>Introducing wemux Multi-User Terminal<\/h3>\n<p>To simplify things, please keep in mind that you can think of\u00a0<strong>wemux<\/strong>\u00a0as a tool that facilitates console viewing and mutual collaboration on the same\u00a0<strong>tmux<\/strong>\u00a0session.<\/p>\n<p>As explained earlier, in the configuration file (<code>\/usr\/local\/etc\/wemux.conf<\/code>), you must have already indicated which users will be allowed to start a\u00a0<strong>wemux<\/strong>\u00a0server, or in other words, a\u00a0<strong>tmux<\/strong>\u00a0session that other users will be able to attach to. In this context, these \u201c<strong>users<\/strong>\u201d are called clients.<\/p>\n<p>To summarize:<\/p>\n<ol>\n<li><strong>Wemux server<\/strong>: a tmux session.<\/li>\n<li><strong>Wemux clients<\/strong>: users joining the tmux session described above.<\/li>\n<\/ol>\n<p>These are the commands that are used to manage\u00a0<strong>wemux<\/strong>\u00a0servers:<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li><strong>wemux<\/strong>\u00a0or\u00a0<strong>wemux start<\/strong>: starts a new wemux server (if none exists; otherwise creates a new one) and creates a socket in\u00a0<code>\/tmp\/wemux-wemux<\/code>\u00a0whose permissions need to be set to\u00a0<strong>1777<\/strong>\u00a0so that other users may connect or attach to it:<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<pre># chmod 1777 \/tmp\/wemux-wemux \r\n<\/pre>\n<ol>\n<li><strong>wemux attach<\/strong>\u00a0hooks you up to an existing wemux server.<\/li>\n<li><strong>wemux stop<\/strong>\u00a0kills the wemux server and removes the socket created earlier. This command needs to be executed from a separate terminal. Alternatively, you can use the exit shell builtin to close panes and eventually to return to your regular shell session.<\/li>\n<li><strong>wemux kick username<\/strong>\u00a0gets rid of the user currently logged on via SSH from the wemux server and removes his \/ her rogue sessions (more on this in a minute). This command requires that the wemux server has been started as root or with\u00a0<strong>sudo<\/strong>\u00a0privileges.<\/li>\n<li><strong>wemux config<\/strong>\u00a0opens the configuration file in the text editor indicated by the environment variable $EDITOR (only if such variable is configured in your system, which you can verify with echo\u00a0<strong>$EDITOR<\/strong>).<\/li>\n<\/ol>\n<p>All of the\u00a0<strong>tmux<\/strong>\u00a0commands listed previously are valid within\u00a0<strong>wemux<\/strong>, with the advantage that the client may attach to a\u00a0<strong>wemux<\/strong>\u00a0server in one of three modes.<\/p>\n<p>To do so, execute the command found in the\u00a0<strong>COMMAND<\/strong>\u00a0column below in a \u201c<strong>prospective client<\/strong>\u201c, so to speak (it will become an actual client once it has joined the wemux server):<\/p>\n<table border=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td align=\"center\" height=\"25\"><b>Mode<\/b><\/td>\n<td align=\"center\"><b>Description<\/b><\/td>\n<td align=\"center\"><b>Commands<\/b><\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"center\" height=\"23\"><b>Mirror<\/b><\/td>\n<td align=\"center\">Read-only, non-interactive<\/td>\n<td align=\"center\">wemux mirror<\/td>\n<\/tr>\n<tr>\n<td align=\"center\" height=\"23\"><b>Pair<\/b><\/td>\n<td align=\"center\">Interactive, client shares cursor with the server<\/td>\n<td align=\"center\">wemux pair<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"center\" height=\"23\"><b>Rogue<\/b><\/td>\n<td align=\"center\">Joins an existing session but allows the client to uses independent windows<\/td>\n<td align=\"center\">wemux rogue<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s take a look at the following screencast for a brief demonstration of the three client modes outlined in the above table (same order). Please note that I used\u00a0<a href=\"https:\/\/www.tecmint.com\/terminator-a-linux-terminal-emulator-to-manage-multiple-terminal-windows\/\" target=\"_blank\" rel=\"noopener\">Terminator<\/a>\u00a0in order to start the server (as user\u00a0<strong>gacanepa<\/strong>) in the left pane and connect a client (as user test) in the right pane.<\/p>\n<p>Thus, you can easily see how a\u00a0<strong>wemux<\/strong>\u00a0server works while interacting with one client. By repeating the the process that is used by a client to join a wemux server, you can have multiple clients do the same simultaneously.<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/Du2CKYqutsQ\" width=\"780\" height=\"439\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h3>Other Features of wemux Terminal<\/h3>\n<p>If the above paragraphs didn\u2019t give you enough reasons to give\u00a0<strong>wemux<\/strong>\u00a0a try, hopefully the following features will convince you.<\/p>\n<p>Users that are allowed to start\u00a0<strong>wemux<\/strong>\u00a0servers (as per the\u00a0<strong>host_list<\/strong>\u00a0directive in\u00a0<code>\/usr\/local\/etc\/wemux.conf<\/code>file) can host multiple sessions simultaneously if the\u00a0<strong>allow_server_change<\/strong>\u00a0directive is set to true:<\/p>\n<pre>allow_server_change=\"true\"\r\n<\/pre>\n<p>To start two sessions named\u00a0<strong>la<\/strong>\u00a0and\u00a0<strong>emea<\/strong>, execute the following commands in two different terminals:<\/p>\n<pre># wemux join la &amp;&amp; wemux start\r\n# wemux join emea &amp;&amp; wemux start\r\n<\/pre>\n<p>Again, we will use\u00a0<strong>Terminator<\/strong>\u00a0to view the two terminals at the same time (this is similar to what you could expect by switching to different consoles with\u00a0<strong>Ctrl+Alt+F1<\/strong>\u00a0through\u00a0<strong>F7<\/strong>):<\/p>\n<div id=\"attachment_18034\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/View-Two-Linux-Terminals.png\" rel=\"attachment wp-att-18034\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-18034\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/View-Two-Linux-Terminals.png\" alt=\"View Two Linux Terminals\" width=\"429\" height=\"266\" aria-describedby=\"caption-attachment-18034\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-18034\" class=\"wp-caption-text\">Img 01: View Two Linux Terminals<\/p>\n<\/div>\n<p>After you press\u00a0<strong>Enter<\/strong>, both sessions are started separately:<\/p>\n<div id=\"attachment_18035\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/Start-Multiple-User-Terminal-Sessions.png\" rel=\"attachment wp-att-18035\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-18035\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/01\/Start-Multiple-User-Terminal-Sessions.png\" alt=\"Start Multiple User Terminal Sessions\" width=\"230\" height=\"409\" aria-describedby=\"caption-attachment-18035\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-18035\" class=\"wp-caption-text\">Img 02: Start Multiple User Terminal Sessions<\/p>\n<\/div>\n<p>Then you can have a client join either session with:<\/p>\n<pre># wemux join la &amp;&amp; wemux attach\r\nOr\r\n# wemux join emea &amp;&amp; wemux attach\r\n<\/pre>\n<p>Finally, to have a remote user (connecting via SSH) start automatically on wemux after logon and disconnect them from the server when they detach, append the follow stanza to its\u00a0<code>~\/.bash_profile<\/code>\u00a0file:<\/p>\n<pre>wemux [mode]; exit\r\n<\/pre>\n<p>where\u00a0<code>[mode]<\/code>\u00a0is one of the client modes listed earlier.<br \/>\nAlternatively, a client can switch from one server to another using:<\/p>\n<pre># exit\r\n# wemux join [server name here] &amp;&amp; wemux [mode]\r\n<\/pre>\n<h3>Summary<\/h3>\n<p>In this article we have explained how to use\u00a0<strong>wemux<\/strong>\u00a0to set up remote viewing of your terminal (and even mutual collaboration) very easily. Being released under the MIT license, wemux is open source software and you can further customize it according to your needs.<\/p>\n<p>The source code is found in wemux Github and available in your system in\u00a0<strong>\/usr\/local\/bin\/wemux<\/strong>. In the same Github repository you can find more information about this program.<\/p>\n<p>Did you find this post useful? Please let us know what you think using the form below.<\/p>\n<p><strong>Reference<\/strong>:\u00a0<a href=\"https:\/\/github.com\/zolrath\/wemux\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/zolrath\/wemux<\/a><\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/wemux-allow-remote-viewing-of-your-linux-terminal\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now we will introduce you to\u00a0wemux\u00a0(a multi-user version of\u00a0tmux), which not only includes the features provided by\u00a0tmux, but also allows users to host a multi-terminal environment where clients can join in viewing or collaborative mode. Wemux View Remote Linux Terminal Session In other words, you can host a session where others can view what you &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-host-multiple-linux-terminals-for-viewing-and-collaboration-with-wemux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Host Multiple Linux Terminals for Viewing and Collaboration with Wemux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13113","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13113"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13113\/revisions"}],"predecessor-version":[{"id":13114,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13113\/revisions\/13114"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}