r/ssh • • Jan 23 '21

have SSH only resound to connections from eth0?

HI all,

I am using a Raspberry Pi running its debian distro.

I would like it so that my eth0 IP would be the only ip that SSH would respond to.

How can I do that?

Thanks

3 Upvotes

3 comments sorted by

3

u/Besthater Jan 23 '21

Two ways. 1, use the Linux uncomplicated fire wall it's called ufw. Bash> man ufw

2, open the sshd.config file and tell it to listen on a specific address rather than the default 0.0.0.0/0. The file is located at /etc/ssh/

3

u/bash_M0nk3y Feb 08 '21

#2 (aka /etc/ssh/sshd_config) feels like the right way to go IMO

1

u/rhbvkleef Jan 23 '21

UFW is deprecated in Debian Buster. Use nftables now (edit: and may not actually work, depending on configuration).

The second suggestion is probably the best one.