EDIT I tried messing around in the file and I noticed that when I remove the “#” in “ !/bin/sh -e” it turned into a plain text document, leaving the “#” in however, turns it into a runnable script. If anyone is wondering how to do/fix this, the file should be as follows:
# !/bin/sh -e
rc.local
iptables-restore < /etc/iptables-rules
exit 0
That is for the server to always setup the IpTables at startup, but you can make it run any command you want in between the “# !/bin/sh -e” and the “exit 0” and it will run those commands on startup.
original post below
So I have my server on a dedicated machine (not running any VM to clarify) and it works perfectly, the only problem I have is that every time it restarts, I have to open the terminal and run “sudo iptables-restore < /etc/iptables-rules” otherwise I can’t HTTPS to the web user interface and I can’t sftp to the server from a different machine until I run that command. i tried modifying the “/etc/rc.local” file but i dont understand much about how to correctly set up the file, I set it up as follows:
!/bin/sh -e
rc.local
iptables-restore < /etc/iptables-rules
exit 0
But saving the file then turns it into a plain text document so I dont really know how to make it run at startup if its no longer a script.
Thanks!