2

Sometimes I get really silly ideas.

This time, the idea is to deliver an easter egg for anyone who decides to try and connect to my server via SSH. Doing so will run a program, such as easteregg.sh, which can provide something like a "hacking" minigame.

However, I have absolutely no idea how to do this! Obviously, such a thing would need to be unobtrusive to actual server admins trying to log in, so there'd need to be some way to distinguish that. Then there's the matter of actually triggering a program to run. Not to mention security: certainly don't want guest users to potentially access server files!

With all that in mind, is such a thing even remotely possible, or is it really just a stupid idea?

3 Answers 3

4

Have you tried changing the user's default shell to the program you're wanting to run upon login? Ultimately, that's all a default shell is: The thing that gets ran after the user successfully authenticates.

1
  • Got it working quite nicely! Commented Jun 6, 2014 at 11:46
1

Have a look at /etc/passwd
The last column specifies to which shell the connection will be pointed. This does not have to be bash, but instead could be your customized shell.

2
  • So could I create a user with no password (or with a "password" that is easy to guess or hidden away somewhere easy to find), and set the shell to my custom script? If I do that, what happens when the script terminates? Commented May 6, 2014 at 14:57
  • 1
    1. yes. 2. never tried that, but i guess the same as what happens when you exit a bash-shell to which you've connected via ssh: connection closes. Commented May 6, 2014 at 15:05
1

Kippo is a SSH honeypot which provides an interactive fake shell, which logs all activity user has on the server.

However, it might not be completely suited for your use, since Kippo is an actual daemon that needs to bind to a port. So, if you have SSH installed in the standard port, you need to install Kippo on some other port, and it might not be that useful.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.