Screen: Difference between revisions

From Grid5000
Jump to navigation Jump to search
m (→‎Multiuser mode: integrate note section directly inside other sections)
Line 19: Line 19:
* <code class="command">screen</code> binary file must be setuid-root:
* <code class="command">screen</code> binary file must be setuid-root:
  <code class="command">chmod</code> u+s /usr/bin/screen
  <code class="command">chmod</code> u+s /usr/bin/screen
{{Note|text=The setuid setting can be avoided if the screen session is initiated by <code>root</code>.}}
* <code class="command">screen</code> socket directory must not be NFS mounted (your default must be changed if it is <code class="dir">$HOME/.screen</code>):
* <code class="command">screen</code> socket directory must not be NFS mounted (your default must be changed if it is <code class="dir">$HOME/.screen</code>):
  <code class="env">SCREENDIR</code>=/tmp/screen-<code class="replace">username1</code>
  <code class="env">SCREENDIR</code>=/tmp/screen-<code class="replace">username1</code>
{{Note|text=There is nothing to configure on Debian systems, as the <code class="env">SCREENDIR</code> is correctly set on this distro by default.}}


=== Howto ===
=== Howto ===
Line 31: Line 33:
* At last, allowed users, like <code>username2</code>, can attach to the multiuser session initiated by <code>username1</code>:
* At last, allowed users, like <code>username2</code>, can attach to the multiuser session initiated by <code>username1</code>:
  <code class="command">screen</code> -r <code class="replace">username1</code>/test
  <code class="command">screen</code> -r <code class="replace">username1</code>/test
 
{{Note|text=A <code class="file">$HOME/.screenrc</code> file can be use to systematically setup the multiuser mode variables <code>multiuser</code> and <code>acladd</code>.}}
=== Note ===
* The setuid setting can be avoided if the <code class="command">screen</code> -r <code class="replace">username1</code>/ is done by root (nothing to configure then on Debian systems, as the <code class="env">SCREENDIR</code> is correctly set on this distro by default)
* a <code class="file">$HOME/.screenrc</code> file can be use the systematicaly setup the multiuser mode. A good one for instance:
 
caption always "%Y-%m-%d %0c%{=b kW} %l  %{=r kd}%-Lw%{= bd}%50>%n%f* %t%?(%u)%?%{-}%+Lw%<%{- Wk}"
vbell on
autodetach on
startup_message off
multiuser on
acladd root

Revision as of 13:48, 3 April 2006

screen is a screen manager with VT100/ANSI terminal emulation.

Basics

  • Start a screen session (creates a single window with a shell in it):
screen
  • Invoke a screen command (consists of a "Ctrl + a" followed by one other character):
C-a <command_char>
  • Detach from this screen terminal (program continues to run when its associated screen session is detached):
C-a d
  • Reattach a session (brings foreground a previously detached session):
screen -r
  • Invoke a screen customization command (used to set options):
C-a : <customization_command>

Multiuser mode

With multiuser mode, screen reveal itself as a powerfull colaborative administration tool.

Requirements

  • screen binary file must be setuid-root:
chmod u+s /usr/bin/screen
Note.png Note

The setuid setting can be avoided if the screen session is initiated by root.

  • screen socket directory must not be NFS mounted (your default must be changed if it is $HOME/.screen):
SCREENDIR=/tmp/screen-username1
Note.png Note

There is nothing to configure on Debian systems, as the SCREENDIR is correctly set on this distro by default.

Howto

  • User, named username1, initiates a basic screen session name test:
screen -S test
  • Then, he enables multiuser mode for this session:
C-a : multiuser on
  • After that, he allows the others, like username2, to connect to his session:
C-a : acladd username2
  • At last, allowed users, like username2, can attach to the multiuser session initiated by username1:
screen -r username1/test
Note.png Note

A $HOME/.screenrc file can be use to systematically setup the multiuser mode variables multiuser and acladd.