How to enter login information for a website from the linux command line

You can try it out with curl, you can Simply use curl like this to login to web page :

curl --user name:password http://somesite.com -v 

You can pass Data to website like this from Stackoverflow answer

    curl -b cookies.txt -c cookies.txt --data "Username=xx&Password=xx&Login=Login" [urlthatyour form submits]

you need cookies if you want to make another curl request after logging in. the session id in cookies will help next curl request authorized.

If you don't want cookies you can use

curl --data "Username=xx&Password=xx&Login=Login" [url that your form submits]

You can additionally refer here for Special Commands


I finally found a way to automatically log in using elinks. It works and it is even easy to configure!

Two options need to be set. This can done by adding the following lines in ~/.elinks/elinks.conf (if the file is not there, create one) or by changing the values at the respective positions in the options dialog within elinks:

    # Save username and password for later use
set document.browse.forms.show_formhist = 1
    # Do not ask for confirmation before a form is submitted
set document.browse.forms.confirm_submit = 0

Steps for a scriptable autologin are then:

  • Set those two options
  • Open the login page in elinks, fill the forms and submit them.
  • Choose to remember name and password for later use.
  • Close elinks
  • Run elinks -auto-submit http://somesite.com

The latter command should perform the automatic login without further user interaction.

I actually use timeout 1m elinks -auto-submit http://somesite.com &, so that I do not have an idling elinks process running in the background all the time.


A simple way to script this is with Selenium.

You can use their Firefox "Test Recorder" plugin to record a test of yourself logging in to the network, and then play back the test.