How to "lock" an user in it's login profile.

Latest response

Hello,

We want an user to answer a question while still in it's login profile and then run a command with the answer as part of the argument.

Whether using csh, bash, or ksh shell the user should be unable to interrupt the profile to drop to the shell.

Once the command has finished the user will be logged of automatically.

=======================================

for bash I think of this solution for the question and logoff in .bashrc

echo "question?"
read answer

command $answer
exit

=====================================
For ksh I guess I can do the same in .profile

=======================================
For csh I do not know yet


Still wondering how to avoid an interrupt, crtl+c to break out of the profile.

I do not want to use /etc/profile or /etc/bashrc for a batch user is not allowed to run "command", but interactive users must use "command"

Kind regards,

Jan Gerrit Kootstra

Responses

We use "consent" files hosted in /etc/. The system-wide shell-rc files then reference the consent files and use shell trap-handlers to prevent skipping on answering the consent banners.

Solved
Hi Tom,

Sorry for the late reply. Thanks for the link.
I found a similar article.

I put my "script" in /etc/profile.d

Kind regards,

Jan Gerrit Kootstra

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.