0

I have a python program and use Debian. I want the user to automatically login into a specific account and for the python program to be automatically launched. And after this happens, the user shouldn’t be able to exit or close the program or be able to interact with anything other than it.The python program uses a text based interface

3
  • Use a resticted shell, start the program via .profile and trap exiting the program with a logout. The user might close the program that way, but will be logged off. Commented Jul 11, 2023 at 11:31
  • Alternatively link an ssh login to the command and trap it. Commented Jul 11, 2023 at 11:38
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Jul 11, 2023 at 12:40

1 Answer 1

0

Maybe just editing /etc/passwd do the trick for you.

Last section in this file specifies the login shell. understanding passwd file

Find Change /bin/bash to /bin/python3 for that user: passwd

So, when user logins, she/he directly enters to python and exiting would be equal to logout from machine.

2
  • He said he wanted to run a specific python script, not just the python command. In addition, depending on the the pam configuration of the host, he might also need to add the program to /etc/shells. Commented Jul 12, 2023 at 13:47
  • The OP asked for a solution to run a command not enter a shell (I think another comment also noted this), you need to change or clarify the solution. Commented Jul 16, 2023 at 23:06

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.