My internet connection is provided by the university. It is protected to a username/password combination. This means when I start up my computer, I have to start a web browser and open an arbitrary website. I am then redirected to a page, which (among other things) contains two forms. In these I have to input username and password. I managed to do this with firefox (which can save the password) and also with links (which loads faster and from the command line).

Is there any way to automate the login process using a bash script? This would allow doing the login when booting,because there is no web browser in raspberry

  • I understand you want to automate the process, but just for the sake of completeness: there is a web browser on the RPi, called Midori, and if you want to stay on the command line, you can use lynx.
    – LuWi
    Commented Apr 20, 2014 at 14:57
  • I need to automate the process. when rapspberry boot, I want that it automatically login to be able to access internet that others process need to run.
    – user14306
    Commented Apr 21, 2014 at 13:09

1 Answer 1


When you login to a webpage, what is (usually) happening behind the scenes is an HTML POST request to a URL. So to replicate that from the command line you need to know:

  1. The URL the POST request is going to
  2. The POST parameters that are being sent (usually a user name and a password)

cURL is a command line tool for interacting with sites via HTML. You can make a POST request by sending data using the --data option along with a string containing parameter names and values in the format curl --data "parameter1=value1&parameter2=value2" http://some-url.com/some-login-page

From your comment, it looks like the fields you need are called login and passwd so the cURL request would look like:

curl --data "login=your-username&passwd=your-password" http://the-url.com

  • it doesn't really work. for username and password, you mean that in the code below I should make:.......... curl --data "user=value1&passwd=value2" hostname/resource. ?? <input name='login' id='user' type="text"> <input name='passwd' id='passwd' type='password'>
    – user14306
    Commented Apr 21, 2014 at 12:16
  • This is the error after entering the command as suggested by you.. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 405 Method Not Allowed</title> </head> <body><h2>HTTP ERROR 405</h2> <p>Problem accessing /console/login. Reason: <pre> Method Not Allowed</pre></p><br/> <br/> </body> </html> Commented Feb 19, 2017 at 21:03
  • You'll need to try the login in Chrome and check what is happening using the Network tab in the inspect window. Then you can reproduce it with curl
    – Jamie Bull
    Commented Feb 19, 2017 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.