[rancid] Scripting clogin with bash and username/password

Hagen, Skye (skyeh@uidaho.edu) skyeh at uidaho.edu
Thu Feb 13 23:50:29 UTC 2014


How about approaching this from a different direction? Instead of specifying the username and password on the command line, you specify an alternate cloginrc file, using the -f option? The alternate cloginrc file could have different user names and passwords.

Skye.

From: Andrew Ohnstad <andrew.ohnstad at gmail.com<mailto:andrew.ohnstad at gmail.com>>
Date: Thursday, February 13, 2014 9:19 AM
To: "rancid-discuss at shrubbery.net<mailto:rancid-discuss at shrubbery.net>" <rancid-discuss at shrubbery.net<mailto:rancid-discuss at shrubbery.net>>
Subject: Re: [rancid] Scripting clogin with bash and username/password

I was hopeful about this, as it sounded good, but no luck.  Adding the -- option didn't help, and even su'ing into an interactive shell for the rancid user and running the command without the sudo didn't help.

Thanks for the suggestion, though!


On Thu, Feb 13, 2014 at 11:06 AM, Per-Olof Olsson <peo at chalmers.se<mailto:peo at chalmers.se>> wrote:
heasley wrote 2014-02-13 16:40:
Thu, Feb 13, 2014 at 10:22:11AM -0500, Andrew Ohnstad:
Thanks for the response.  The full command line I am using is (I
automatically am enabled via TACACS+):

sudo -u rancid /usr/libexec/rancid/clogin -u<my-username> -p<my-password>
-c where <router>

If I add the -d argument to see the expect debugging, I can see that it
launches the ssh spawn with the correct username, but it is blatantly
disregarding the password supplied on the command line...

spawn ssh -c 3des -x -l <myusername> <router>

this should work; what version of rancid?
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net<mailto:Rancid-discuss at shrubbery.net>
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


sudo -l[l] [-AknS] [-g group name | #gid] [-p prompt] [-U user name] [-u user name | #uid] [command]
is sudo using -p option for it's on to set a prompt? -u for own username...

test
  "sudo -u rancid -- /usr/libexec/rancid/clogin -u<my-username> -p<my-password> -c where <router>"

>From sudo man page
...
    --          The -- option indicates that sudo should stop processing command line arguments.
...

Have seen this before to ssh/telnet commands


/Peo
----------------------------------------------------------
Per-Olof Olsson               Email: peo at chalmers.se<mailto:peo at chalmers.se>
Chalmers tekniska högskola    IT-service
Arvid Hedvalls backe 6        412 96 Göteborg
Tel: 031/772 6738  Fax: 031/772 8680
----------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20140213/0b081222/attachment.html>


More information about the Rancid-discuss mailing list