iptables-restore run but keeps reverting - related to ufw?
by nachtmsk from LinuxQuestions.org on (#5BVWD)
Hi,
Ubuntu box. I changed the port for ssh to something else, lets say 345, in /etc/ssh/sshd_config
I run iptables-save >myfile.ipt
open myfile.ipt and modify the line that says
-A ufw-user-input -p tcp -m tcp -dport 22 -m comment --comment "\'dapp_OpenSSH'" -j Accept
to this:
-A ufw-user-input -p tcp -m tcp -dport 345 -m comment --comment "\'dapp_OpenSSH'" -j Accept
Then I run
iptables-save < myfile.ipt
I login using the new port and all is well.
I reboot and I can't get in using the new port. I run iptables-save again and the port is back to 22.
I'm not very familiar with ufw but I see it's mentioned in the rule so I'm assuming iptables and ufw are somehow related
So now I'm looking in /etc/ufw and I see the following two files
user.rules
user6.rules
user.rules has this:
-A ufw-user-input -p tcp --dport 22 -j ACCEPT -m comment --comment 'dapp_OpenSSH'
user6.rules has this:
-A ufw6-user-input -p tcp --dport 22 -j ACCEPT -m comment --comment 'dapp_OpenSSH'
So to make this new port for ssh stick, I'm guessing I need to modify the rule in /etc/ufw/user.rules to change the port from 22 to 345.
1. Is this correct, do I need to modify the file /etc/ufw/user.rules
2. What is the user6.rules for, who is user6?
3. Is there a more appropriate way to modify my ssh port?
Thanks
Nacht


Ubuntu box. I changed the port for ssh to something else, lets say 345, in /etc/ssh/sshd_config
I run iptables-save >myfile.ipt
open myfile.ipt and modify the line that says
-A ufw-user-input -p tcp -m tcp -dport 22 -m comment --comment "\'dapp_OpenSSH'" -j Accept
to this:
-A ufw-user-input -p tcp -m tcp -dport 345 -m comment --comment "\'dapp_OpenSSH'" -j Accept
Then I run
iptables-save < myfile.ipt
I login using the new port and all is well.
I reboot and I can't get in using the new port. I run iptables-save again and the port is back to 22.
I'm not very familiar with ufw but I see it's mentioned in the rule so I'm assuming iptables and ufw are somehow related
So now I'm looking in /etc/ufw and I see the following two files
user.rules
user6.rules
user.rules has this:
-A ufw-user-input -p tcp --dport 22 -j ACCEPT -m comment --comment 'dapp_OpenSSH'
user6.rules has this:
-A ufw6-user-input -p tcp --dport 22 -j ACCEPT -m comment --comment 'dapp_OpenSSH'
So to make this new port for ssh stick, I'm guessing I need to modify the rule in /etc/ufw/user.rules to change the port from 22 to 345.
1. Is this correct, do I need to modify the file /etc/ufw/user.rules
2. What is the user6.rules for, who is user6?
3. Is there a more appropriate way to modify my ssh port?
Thanks
Nacht