Skip to content

Instantly share code, notes, and snippets.

@pjobson
Forked from lynus/wan_ssh
Created December 11, 2022 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjobson/f451b68bef5855d99d4df8e94a3fcb33 to your computer and use it in GitHub Desktop.
Save pjobson/f451b68bef5855d99d4df8e94a3fcb33 to your computer and use it in GitHub Desktop.
openwrt:allow wan ssh into your wrt
by default,openwrt do not allow ssh access from wan, here are two method to change that:
1.login into your wrt from a lan host.issue the following command:
iptables -F
the command "flush away" all the firewall rules,including the one that rejects ssh request from wan.
now you can try ssh from anywhere.
aware that the firewall deactivation leads to highly security risk.and after the wrt restarts ,all default firewall configuration comes back.you hava to "flush" the rules once again.
2.add the following lines in /etc/config/firewall :
config rule
option src wan
option dest_port 22
option target ACCEPT
option proto tcp
after restart ('reboot' commmand),wrt accept port 22 request (in this case ,ssh request)from wan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment