Is there a way to lock down an account to when it logs in, it runs a specific command/script and then exits after the action is completed, while keeping it locked out of performing any additional operations if it happens to break out of it's script/command?
Would prefer a native way of accomplishing this, but not necessary.
The old school way to handle this is
exec
ing your code from the user's.profile
. By usingexec
it will replace the login shell. So if the user manages to break out there isn't a shell for them to escape back to. When your login process exits Linux kills the session.