2

I have a program which uses python's cmd module for command line interfaces.

Now I want it to run on my Linux server whenever any normal user logs in to it, in a way that user never gets the default Linux prompt (i.e he should not be able to kill the program or send it to background or any such stuff).

For security issues the program should never allow user to gain access of normal prompt. The user should always use program's cmdline to fire all commands. (The program has various filters built in it).

Tried putting the program execution command in /etc/password (replacing default bash shell with the program execution cmd) for the user & also tried to put it in users .bashrc file, but of no use; user can still gain access default prompt.

Any pointers for this can very helpful.

4
  • 1
    Why this topic is tagged as python? Commented Mar 2, 2012 at 6:12
  • 3
    Because user want to run python shell instead of bash Commented Mar 2, 2012 at 6:26
  • Remind me never to work on your system. Are you going to allow the user to use an editor at any stage? Or are you going to make them use an editor written in Python? If you let them use vim or a vi workalike, and if you've got a shell on the system, then they have access to that shell. As a for instance... Commented Mar 2, 2012 at 6:49
  • @JonathanLeffler : hahaha, the program provides a set of services which users make use of, but for my server to be secure i don't want them gain access of anything more than those services... :) Commented Mar 2, 2012 at 7:07

1 Answer 1

1

This probably belongs on superuser, but you should add it into /etc/shells file, and set a user's login shell to that one.

For example: sudo useradd -d /path/to/newuserhomedir -s /usr/sbin/nologin newusername would create a guy called newusername whose login shell would be the program /usr/sbin/nologin.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.