Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
So you want to limit where certain users or group(s) of users and login from, rather than lock out their account.
For ssh, you can use AllowUsers or AllowGroups to explicitly determine who is allowed to login via ssh. Using AllowUser user1
will only allow user1 to log in and will deny all other users, including system users who are targets of brute force attacks.
Suppose you only want root to be able to login to tty1.
You can control that with an /etc/security/access.conf entry.
-:ALL EXCEPT root:tty1
This file is well commented. If yours isn't, then look in man 5 access.conf and man pam_access.
You can prevent a normal user from logging in on certain terminals. They will still be able to log in on other terminals. For example, you asked about a serial terminal. Maybe you only want a member of an admin group to be allowed to login to that terminal. Suppose that you only want three particular users to be able to use ssh. They might be the people who administer the server and need to do so remotely. Adding their names to the AllowUsers entry will deny ssh logins under any other account. You still want a normal user to be able to login normally.
I just reviewed the manpage for the "passwd" command. I should have used the term "lock" instead of disable. The root user can lock an account using the passwd command. That user will not be able to login. Your query seemed to me to be about limiting logins on certain terminals and on restricting who can use ssh to login. In other words, about controlling access rather than denying it completely.