Skip to main content

Posts

Showing posts with the label sshd

How to prevent a user from login in, but allow “su – user” in Linux?

You can use  AllowUsers  /  AllowGroups  if you have only a few users/groups that are allowed to login via ssh or  DenyUsers  /  DenyGroups  if you have only a few users/groups that are  not  allowed to login. Note that this only restricts login via ssh, other ways of login (console, ftp, …) are still possible. You need to add these options to your  /etc/ssh/sshd_config  file for most ssh installations. If you have set the login shell to  /bin/false  you can use  su -s /bin/bash user  (replace  /bin/bash with the shell of your choice)

How to prevent a user from login in, but allow “su - user” in Linux?

You can use  AllowUsers  /  AllowGroups  if you have only a few users/groups that are allowed to login via ssh or  DenyUsers  /  DenyGroups  if you have only a few users/groups that are  not  allowed to login. Note that this only restricts login via ssh, other ways of login (console, ftp, ...) are still possible. You need to add these options to your  /etc/ssh/sshd_config  file for most ssh installations. If you have set the login shell to  /bin/false  you can use  su -s /bin/bash user  (replace  /bin/bash with the shell of your choice)