Announcement

Collapse
No announcement yet.

Sharing a Bash Session

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Sharing a Bash Session

    Sometimes when you need to show more than a few people how to do something having the audience standing behind you looking over your should might not be practical. Maybe some are in remote locations.
    Or maybe you have to maintain or troubleshoot a host located else where but the remote administrator what to follow the progress.
    This is where the "screen" is practical. This will most likely require a package install.

    This is what you do from the administering host.

    First you create a named session. In this case we just call it training but could be almost anything.
    screen -S training

    The add the users that is allowed to attend. In this example Ill just use root again. A list of users should be devided with commas.
    Press CTRL-A and type in :addacl root

    If needed you can use below to set alternate permission for the attending users.
    Users could be one user, a list of users seperated by comma or * for all users.
    permbits represent r, w and x prefixed with + or - to set or remove read, write or execute permissions in the session.
    The list should be # for all windows and ? for all commands.
    Press CTRL-A and type in :chacl username permbits list
    ex. :chacl kiddie +rwx "#?"

    Then turn on multiuser mode.
    Press CTRL-A and type in :multiuser on

    From the joining clients you do the following to join the session.
    screen -x 192.68.1.2/training

    Ofcourse you should pick the IP number or hostname that fit your environment.
    Now you are up and running. What ever you type in will be shown in all the shells that joined the session.
    Remark that this assume you did not change your meta key from CTRL-A.

    To verify this you can do an "echo $SHLVL" to see what ID your screen session is. It should be greater than 1 if it worked.

    When you are done you kill the session.
    Press CTRL-A and type in :quit or press CTRL-A and press K

    All users will be able to both read and write from the shell if you dont change the permissions
    .
    If you are used to use the VI editor this should come quite easy as these sessions have the same look and feel.

    It is also quite handy to use screen if you do some work from the office and need to connect to the same shell from home to verify things are stil well. And maybe even use the same screen the next day at work.
    Another usefull thing about this is that if you are working on at server at the office from a remote location and get disconnected you can use screen -d -r to reconnect and detach first if needed. Then you dont loose a lot of work.
    When you are in screen mode the CTRL-A :windowlist will present you with all available windows.
    Each window can be renamed to something usefull using CTRL-A :title NewWindowTitle to ease working with several windows.

    I recommend checking out the man and info pages on this tool. it is quite handy for a lot of things.
    Certified Security Geek
Working...
X
😀
🥰
🤢
😎
😡
👍
👎