1

i was wondering if it is possible to force log out a user (anyone other than root) when trying to login via tty (ctrl+tab+f1/f2/f3..). The user should be able to use pts with no problems. Using CentOS 7.

slm
  • 363,520
  • 117
  • 767
  • 871
Harish Agadi
  • 21
  • 1
  • 2
  • Please add Linux distribution to the question. – Rui F Ribeiro Aug 01 '18 at 12:56
  • 2
    `pam_access` should be able to take care of that. See `man pam_access` and `man access.conf`. – Stéphane Chazelas Aug 01 '18 at 13:07
  • This question is unclear. It could be that it is asking how to prevent non-superusers from logging on on virtual terminals. It could be that it is asking how to kick other non-superuser users off when someone logs on on a virtual terminal. It can be read either way. – JdeBP Aug 01 '18 at 15:56

1 Answers1

1

You can add entries to /etc/security/access.conf which disallow logins to the TTYs like so:

-:ALL EXCEPT root

There's other examples in this file if you're looking for additional use cases. NOTE: The above says to remove ALL except root.

References

slm
  • 363,520
  • 117
  • 767
  • 871