4

I want to build a dedicated machine I can use for testing candidates in our company. The machine should run Linux with SSH server listening for connections.

I would like to send each candidate a user and password(the same one).

Upon connection, he will be presented with a message on how to proceed with the test and submit his work. If he disconnect, all the changes will reverted, files, history, everything needs to be erased.

I will also like to support multiple users connecting with the same credentials. so I guess I need to implement some kind of virtualized environement that is created on the fly for each SSH connection.

There is actually an implementation of this in Internet war games ( such as this http://overthewire.org/wargames/bandit/bandit0.html)

Any idea on how to achieve that ?

closed as too broad by Tero Kilkanen, mdpc, rnxrx, Jenny D, Daniel Dec 16 '16 at 22:07

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    They should all connect to the same server? Per-user VM (created automatically) is not an option? – mzhaase Dec 8 '16 at 15:53
1

Per-user messages could be an echo statement in $HOME/.bashrc or similar. Even if the user alters that file, they need to login first to do that and even then they would have already seen the message. A better way may be something in /etc/motd. That's what that file is used for.

Have a look at Patrick's answer here for executing something on logout. You could simply reboot the VM and have the hypervisor automatically boot from a clean snapshot/frozen image/whatever. Personally, I would not use .bash_logout for this as it takes a bit of fiddling to make sure the user cannot modify/delete/rename/symlink the file. PAM would be more foolproof.

If you don't want to reboot the VM, maybe a r/o partition with a copy of the original system files could be rsync'd (# rsync -av /mnt/ro/home/ /home/ --delete) to $HOME/ after logout.

Not the answer you're looking for? Browse other questions tagged or ask your own question.