How can allow an ssh connection only over vpn

6,967

You can control it using the ListenAddress directive available in your ssh daemon config file

Something Like

sudo nano /etc/ssh/sshd_config

Reach the line:

#ListenAddress 0.0.0.0

Uncomment if necessary, and edit it accordingly to your vpn configuration, something like:

ListenAddress 10.10.0.1

Restart the daemon

sudo service ssh restart

Check if it works

Keep in mind you can also tune your firewall rules to further restrict access to certain subnet / ports, in this case your vpn network

Hope it helps

Share:
6,967

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments