Disable open in terminal for spesific user

Latest response

I have looked at

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/desktop_migration_and_administration_guide/disable-command-line-access

How can I apply this setting to only 1 spesific user, so its not applied as a system wide setting.

Responses

Hello Pål Andreas Tomter,

If you wish to get the command/terminal access to be disabled for a user then set the nologin shell for the local user. This would disable terminal/CLI access, however, user could still login via GUI if available. Lets say if I wish to do the same for user called "test" then this could be done by running below commands as root:

[root@AnsibleClient1 ~]# usermod -s /sbin/nologin test
[root@AnsibleClient1 ~]# grep test /etc/passwd
test:x:501:501::/home/test:/sbin/nologin

If there is a need to restrict user access at certain times then this can be done using "pam_time.so" module. Refer these links: https://access.redhat.com/solutions/887813 https://access.redhat.com/discussions/6979887#comment-2350755

Hope this helps! Though I'm not sure if I have understood your query correctly.