Configuring OpenSSH VPS Server on Linux OS

OpenSSH server on VPS is the first and main method of access to Linux and FreeBSD server; by default, it is configured quite securely and allows all users to connect to the this system.

In the Debian distribution, the root user can only connect using the keys and cannot connect using the password. The configuration file itself may contain settings that may be useful to you depending on the situation. Keys DennyUsers and AllowUsers – Allows you to restrict users and IP from which they can connect. For example, these lines:

DennyUsers login
AllowUsers "root@15.45.78.5,johnn,anny@78.65.55.0/24"

Only root, johnn, anny users can connect. In addition, the root user can only connect with IP 15.45.78.5 and anyy from the 78.65.55.0/24 subnet.

Key Match – Let’s redefine some settings and global restrictions for connections that fall under the filter.

For example:

PasswordAuthentication no
PermitRootLogin no
Match Address 1.2.3.4,9.8.7.6 Host vps12.hostry.com
PasswordAuthentication Yes
PermitRootLogin yes

For connections from addresses 1.2.3.4,9.8.7.6 and from the node vps12.hostry.com will allow you to use a password

X11Forwarding no
Match User John Address 172.16.1.*
X11Forwarding yes

Was this article helpful?

Related Articles

Leave A Comment?