Firefox in Ubuntu : how to automate basic authentication password confirm dialog

4

2

I have an Ubuntu workstation with Firefox always open on a (autorefreshing) web page protected by basic auth.

At startup, I have autologin and automatic Firefox start on the page and I have saved the basic auth credentials.

I'd like to confirm in some automated way the username/password dialog box which pops up on the first opening of the page, or I'd like to know if there's any hack to avoid this dialog box.

I tried setting the homepage to http://username%3Apassword@myserver/mypage put that doesn't stop confirmation dialog boxes.

golemwashere

Posted 2009-09-24T12:56:14.140

Reputation: 316

Answers

1

Try xdotool or IronAHK. I haven't used either of them, but they're basically tools for simulating mouse and keyboard events, which sounds like one way of solving your problem.

Edit: See the comments for the exact answer.

Ryan C. Thompson

Posted 2009-09-24T12:56:14.140

Reputation: 10 085

Yay! it works with WID=xdotool search "Authentication Required" | head -1 xdotool windowfocus $WID xdotool key Return

Thanks – golemwashere – 2009-10-07T10:17:02.957

2

For people coming from google:

The easiest way to prevent that annoying popup is to got to "about":config" and add a new integer entry:
Name: network.http.phishy-userpass-length
Value: 255

With this in place you can then use http://username:password@myserver/mypage and there will be no confirmation boxes. More information can be found at http://kb.mozillazine.org/Network.http.phishy-userpass-length

KillerX

Posted 2009-09-24T12:56:14.140

Reputation: 141

1

There is an automation addon for firefox called iMacros.
I have not used it first hand and cannot vouch it it will help you solve your problem.
You could give it a short try.

nik

Posted 2009-09-24T12:56:14.140

Reputation: 50 788

I am afraid the unattended parts are not available on linux: http://wiki.imacros.net/Web_Scripting#How_to_run_iMacros_unattended

– golemwashere – 2009-09-25T09:14:48.663

0

xdotool is really useful! Thanks!

This is my script in Ubuntu Karmic. I have a key combination that launches this code, so I can get really fast to a htaccess password protected site:

#!/bin/bash

#If Firefox is not running, wait 4 seconds to open.       
if [ "$(pidof firefox)" ]
  then
    timetosleep=1
  else
    timetosleep=4
fi

#Launch firefox
firefox http://wiki.example.org &

#Sleep until the window comes up
sleep $timetosleep

#Press enter!
WID=`xdotool search --title Identi`
xdotool windowactivate $WID
xdotool key Return

PD: As my firefox is in spanish I search for "Identificación" instead of "Authentication".

Ignacio Huerta

Posted 2009-09-24T12:56:14.140

Reputation:

0

PasswordProfiler is protection like this is very weak and a smart user can bypass it easily.

joe

Posted 2009-09-24T12:56:14.140

Reputation: 11 615

FYI to those with edit authority, link is dead – Jax – 2010-05-12T17:13:41.587

I do not need to secure this workstation, it's in a safe and locked place available only to authorized people, the problem is automating the password submission. – golemwashere – 2009-09-25T06:55:47.587