I've develop an interactive shell script, where my users will perform a few operations. I've create a user that runs this scripts automatically on startup.

Startup script ./.bash_login

This script performs correctly my interest, it runs my python interactive script, and when I kill my script, it runs exit and finish my connection.

The security problem appears when I'm connecting using my private key with something like this

ssh user@host.com -i security_key '/bin/bash'

It runs bash shell and I can get something I don't want control over the machine.

My question is, is it possible to change the shell at /etc/passwd to my script or It's preferable to jailroot this user?


  • You know you can tie a particular command to the key by editing the entry in the authorized_keys file ... command="/scripts/interactive_shell.py" ssh-rsa AAAAB3NzaC1yc... – user9517 May 8 '13 at 11:18

I've tried to change the /etc/passwd file to something like this

sec_user1:x:1001:1001:Secure User 1:/home/sec_user1:/scripts/interactive_shell.py

It works! and if you try to execute some kind of code I'll get this:

option -c not recognized

Usage: console.py [OPTION] [PATHS]
    --name=value    whatever
    --help          display help

I soupose this is 100% secure, but it's you cannot run commands easilly.

| improve this answer | |

I would check out rssh (the restricted shell).

| improve this answer | |
  • Please explain why you suggest rssh – weeheavy May 8 '13 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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