1 Answer
1

If you're talking about a web-based login screen, there's a good chance it sets a cookie and a corresponding token, which change upon each viewing, in order to protect against Login CSRF. This would also prevent what you are trying to do from working.

Basically, this means that the form sets a unique cookie along with a token in a hidden form element, ensuring that the person submitting the form is the same person that requested the page.

On the off-chance that they don't do this, you could write a script to login via curl, and then place that script into /etc/network/if-up.d/ (as described here).