I am making a text based RPG, and would like to run a bash script upon login of a certain user (The script will basically be lua then once the file is done, logout) but I don’t want the users to access the shell, and I want it to log out as soon as it finishes.
I am at loss as to how to make the script so ctrl+c will not stop it and give users shell access..
I’ve googled, but I must not be using the right phrase…
If anyone could help me, that would be greatly appreciated.
They will be logging in over SSH
You could try setting the script as the default shell of the user:
The script will then be run in place of the default shell and the user will be logged out the moment the script ends.
You will need to add the script to
/etc/shellsfor it to be accepted as valid login shell.Disclaimer: There may be other security implications to this approach, so do take this with a pinch of salt and look further into it before deploying on a production system. For example, you may want to run your script in restricted mode if applicable.