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
1 Answer
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: 
So, when user logins, she/he directly enters to python and exiting would be equal to logout from machine.
- He said he wanted to run a specific python script, not just the python command. In addition, depending on the the
pamconfiguration of the host, he might also need to add the program to/etc/shells.aviro– aviro2023-07-12 13:47:40 +00:00Commented 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.number9– number92023-07-16 23:06:20 +00:00Commented Jul 16, 2023 at 23:06
.profileand trap exiting the program with a logout. The user might close the program that way, but will be logged off.