I read from this page how to restart the router using curl.
I got the command for my router

It works when i put it in browser's address bar but when I use curl

curl -u admin:mypass ''

It does not work.
no output is there in Terminal Screen.
Result of --

curl -i -u admin:mypass ''

gives this--

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="450TC1"
Content-Type: text/html
Transfer-Encoding: chunked
Server: RomPager/4.07 UPnP/1.0

<title>Protected Object</title></head><body>
<h1>Protected Object</h1>This object on the RomPager server is protected

Output of

curl --verbose -u admin:mypass ''

Gives this --

* About to connect() to port 80 (#0)
*   Trying connected
* Server auth using Basic with user 'admin'
> GET /Forms/tools_system_1?restoreFlag=0&Restart=RESTART HTTP/1.1
> Authorization: Basic YWRtaW46c2hhcmluZ2FuMDA3
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/ libidn/1.23 librtmp/2.3
> Host:
> Accept: */*
< HTTP/1.1 303 See Other
< Location:
< Content-Length: 0
< Server: RomPager/4.07 UPnP/1.0
< EXT:
* Connection #0 to host left intact
* Closing connection #0

But curl -u admin:mypass returns this. Works fine!

</title><meta http-equiv="Content-Type" content="text/html; charset=
<meta http-equiv=Content-Script-Type content=text/javascript>
<meta http-equiv=Content-Style-Type content=text/css>
</head><frameset rows="65,75,*" framespacing="0" border="0" frameborder="0">
<frame name="header" noresize src="status.html" marginwidth="0" marginheight="0">
<frame name="navigation" noresize src="navigation-status.html" marginwidth="0" marginheight="0">
<frame name="main" noresize src="../status/status_deviceinfo.htm" marginwidth="0" marginheight="0">
  • Try running curl with additional switches, like -i and --verbose, e.g. curl -i -u admin:mypass 'http://… etc. The router doesn't return any content in body, you should investigate HTTP headers instead; add output of these commands to your question so we can better understand what's going on. It's possible the router doesn't accept HTTP authentication and uses cookies instead. Or maybe the router accepts only the POST request for this command. – jnv Mar 27 '13 at 18:53
  • using wget instead of curl works – Gaurav Sharma Mar 27 '13 at 19:09
  • after sending that command in web browser, gets opened up so i tried curl on this address, but only 2 times out of 4, the router restarted. It gave the same error "RomPager server is protected" 2 times. – Gaurav Sharma Mar 27 '13 at 19:46

Stick to what works for you. Based on your now previous comment, it's possible there's some special character in your password; try wrapping your credentials in quotes, e.g. -u "admin:pass".

If Wget works, use it instead; you can use -O - switch to redirect output to console (similar to Curl's default behaviour), instead of saving the file.

Sending a data as POST request may also work, e.g.:

curl -u 'admin:mypass' --form 'restoreFlag=0&Restart=RESTART' ''

Also notice that in your output, router returned different message for -i and --verbose flags—401 Unauthorized for -i and 303 See Other for --verbose. The latter, I assume, lead to a successful restart. I don't think that flags are related to router's behaviour, it seems to be completely random.

Anyway, I don't think this question is specific for Ubuntu in any way, I recommend asking at SuperUser.


co-incidentally i was trying to reboot the router so decided to make a search rather than reinventing the wheel so i landed here.

i found something interesting just run this, just run this directly your router will be rebooted

curl --verbose -u user:pass ''


curl --verbose -u user:pass '' -e ''


wget -v -F -S --http-user=user --http-password=pass --ignore-length --referer="http://admin:adminnew@" "" -O "info.output.file"

you can remove the -v and -S from wget command

sometimes curl fails at authentication randomly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.