Linux examination machine

Date March 4, 2009

Two days ago i did a nice interview, it was interactive exam, someone ask you through the phone to troubleshoot/do many things and in the same time he see what you do and what is the output of your commands, in my company, when i was interviewing people, all what i do is oral questions.. its oral conversation, but after making that interview i decided to prepare a examination machine to use it for future interviews i do in the company i work in.
the trick was using SCRIPT(1) and named pipe (fifo), simply like this:
in the first session do this command:
$ mkfifo foo; script -f foo
in another session do cat for ‘foo’
$ cat foo
and now you will see everything done in the first session, yup so nice.
to use it when the user login (for ex/ through ssh), you can put it on .bashrc file for that user, for example put those at the end of .bashrc file:
if [ ! -p /tmp/`whoami` ]
then
mkfifo /tmp/`whoami` ;
fi
exec script -f /tmp/`whoami`

thats it, now after user login, do cat /tmp/UserLoginName in your session ;)

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG

2 Responses to “Linux examination machine”

  1. Amos Shapira said:

    nice! I’ll add this to my arsenal.

    but why not just use screen(1)? This way you should be able to share the session too.

  2. Shaker said:

    Yes you can do it also through screen, but i found it much simpler to use fifo and script, thinking about screen will lead me to think about what is the user actions and what if s/he deatached her screen and .. so i wanted to keep it simple ;)
    yes its also works through screen.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>