Saturday, July 9, 2022

[SOLVED] Gitlab avoid user login via SSH

Issue

When I create a user on Gitlab, it creates a regular user on linux and it can login using a regular SSH protocol with same password an user.

How can I disable the SSH login using SSH to desired users? All my server is exposed to that users.

Thank you


Solution

Edit the sshd_config file adding this line

DenyUsers username1 username2 username3 username4
DenyUsers
separated by spaces. Login is disallowed for user names that
match one of the patterns. â*â and â?â can be used as wildcards
in the patterns. Only user names are valid; a numerical user ID
is not recognized. By default, login is allowed for all users.
If the pattern takes the form USER@HOST then USER and HOST are
separately checked, restricting logins to particular users from
particular hosts.

Read more: http://linuxpoison.blogspot.com/2008/08/how-to-deny-ssh-access-for-certain-user.html#ixzz3QkT71bsV



Answered By - levi
Answer Checked By - Cary Denson (WPSolving Admin)