Hello,
I would like you to provide more details, in regards to your configuration.
First, are you configuring device with a legacy firmware device or a RutOS?
How do you perform the reversing of Client/Server, as changing these in web interface would require you to replace certain options within the configuration?
Opening the port 5004 is the authorization for the flow, as opening the port creates the necessary IPtables firewall rules.
Settings in SSH can be changed using certain options via UCI commands, or by editing /etc/config/rs configuration file with the text editor, however, if you are going to perform factory reset afterwards, I assume, you would like to backup it?
Best regards,