0

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
-------------------------------
/scripts/interactive_shell.py
exit

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 [email protected] -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?

Thanks!

1
  • 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, 2013 at 11:18

2 Answers 2

1

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.

0

I would check out rssh (the restricted shell).

1
  • Please explain why you suggest rssh
    – weeheavy
    May 8, 2013 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .