Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-28 Thread Carlos E. R.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



The Saturday 2008-01-26 at 06:27 -0500, Aaron Kulkis wrote:

...


He can generate keys on his local system, however, it is
not possible to store either part on the router.
I have a similar type of router... it's a dumb little
machine meant stricty for interactive administration
(in fact, the ONLY way to do so is through a web
browser)


Mine is a cute little thing, supplied by my ISP with the adsl connection, 
and made by Broadcom


It has an administration web server, which uses http instead of https for 
the password, and requires javascript on the client, and text only clients 
like links or lynx fail.


But it also has telnet and ssh, and you can enable/disable any of them 
from the local/remote side, or allow from a range of IPs. it also has 
tftp, to save/upload the configuration or to flash the device.


The console commands are not bash, but it's own limited set of commands:

help
logout
save
save_and_exit
save_and_reboot
restore_defaults
reboot
adsl
atm
brctl
dumpcfg
arp
defaultgateway
dhcpserver
dns
igmp
lan
nat
passwd
ppp
proxyarp
remoteaccess
rip
route
statistics
wan
ping
sntp
snmp
build
tftp
version
wlan
log
macfilter
qos

and that's it. It can send the log of my syslog over the network, so I can 
see its firewall working, and when the connection failed; it also has snmp 
that I haven't been able to make much use of it. It does what it is 
supposed to do quite well for its size and price.


One thing the log doesn't have is the external IP, I have to get it by 
command. Now that I know how to execute commands using "expect", I could 
use the trick to detect IP change in the log, and then use the command 
interface on a script to get the IP and log it. I wonder if I can fire it 
from syslog-ng.




 to the "'remote' router with embedded" (linux?). Carlos
 didn't say what limited commands were available, or
 whether it was even possible to copy files onto the router.


It seemed pretty obvious to me.

Lots of cheap "home" routers are braindamaged.


We get what we pay for, I guess. Most users will be windows types, and 
they are not used to the shell. But I would appreciate an https interface, 
instead or added to the available http.



Ha! I would like the thing having a plugable flash card, so that I could 
buy my own memory card, program it, and replace its card, and thus play 
around with the features I wanted instead of theirs. The card being 
removable would allow ease recovery in case of a bad flashing.


I must be dreaming, not for that Little money!

- -- 
Cheers,

   Carlos E. R.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQFHnbM+tTMYHG2NR9URAksvAJ4qSH50O2l1AyErIn+0MIVvIGDLIQCePoX8
trezMmchR2GU8v+O/EXm3Po=
=vvtj
-END PGP SIGNATURE-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-28 Thread Carlos E. R.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



The Friday 2008-01-25 at 09:40 -0500, Aaron Kulkis wrote:


 I want to enter an ssh session without having to type the password (to be
 used by a script). The "remote" is a router with embedded, and it is not
 possible to create public key pairs because it is not a shell, but one
 with a limited command set.


You probably can't provide a "typed password" from anything
other than the keyboard itself.


I solved it using "expect" - see other mails.

Ah! It is your mail arriving three days late, as usual. You should get a 
gmail account :-p




For security reasons, ssh and similar programs are
generally written to read only from /dev/tty.


Fortunately, "expect" can do the trick.



Is it possible to create a file called "rhosts"
or "hosts.equiv" on the router?


Nothing at all, no files; or I would create a key pair.



 If any one is worried about security, don't: for instance, if you use
 subversion with ssh access (to Novell, for instance) the password is
 stored in clear text in ~/.subversion/auth, and the file is world
 readable! (Was, rather, I changed it). So subversion must be giving the
 password somehow.


You've gotta be kidding.
Someone needs to hit the subversion devs with a clue-bat.



It is a documented feature of subversion. And they also document how to 
dissable it, on the client. They should be able to dissable it on the 
server side! I mean, the server side telling the clients not to store the 
password.


However, it is very convenient.

- -- 
Cheers,

   Carlos E. R.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQFHna6MtTMYHG2NR9URAuHPAJ9oMD14Jk+gFtVraC6QI1AT669j0wCfedHM
vBYLLnMnSHsDMyymud2aveo=
=FaZb
-END PGP SIGNATURE-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-28 Thread Aaron Kulkis

Jim Cunning wrote:

On Friday 25 January 2008 13:25:25 Ken Schneider wrote:

Hans Witvliet pecked at the keyboard and wrote:

On Fri, 2008-01-25 at 14:12 +0100, Carlos E. R. wrote:

[...]

I want to enter an ssh session without having to type

 the password (to be used by a script). The "remote"
 is a router with embedded, and it is not possible to
 create public key pairs because it is not a shell, but

one with a limited command set.

>>>

As other posters mentioned 'expect' i won't.
But as you specifically mention "ssh" i would rather

>>> advise you to generate a ssh-key-pair and copy the
>>> public-one over to the other machine into the
>>> authorizedkeys file.


No asking for pwd's anymore

>>

What part of "it is not possible" is not understood here?


Don't be so quick to be critical. I took Carlos statement

> to mean it was not possible on the REMOTE system, but it
> is certainly possible on his local one, which is all that
> is required so far as generating keys goes.

He can generate keys on his local system, however, it is
not possible to store either part on the router.
I have a similar type of router... it's a dumb little
machine meant stricty for interactive administration
(in fact, the ONLY way to do so is through a web
browser)



However, it may not be possible to copy his public key

> to the "'remote' router with embedded" (linux?). Carlos

didn't say what limited commands were available, or

> whether it was even possible to copy files onto the router.

It seemed pretty obvious to me.

Lots of cheap "home" routers are braindamaged.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-28 Thread Aaron Kulkis

Carlos E. R. wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



Hi,

I want to enter an ssh session without having to type the password (to 
be used by a script). The "remote" is a router with embedded, and it is 
not possible to create public key pairs because it is not a shell, but 
one with a limited command set.


You probably can't provide a "typed password" from anything
other than the keyboard itself.

For security reasons, ssh and similar programs are
generally written to read only from /dev/tty.

Is it possible to create a file called "rhosts"
or "hosts.equiv" on the router?
on the





I can give the user, like:

ssh [EMAIL PROTECTED]

but I haven't found a way in the man to give also the password, as there 
is for instance in ftp.


I think there is something like chat ? but I'v never used it and I'm 
unsure how.



If any one is worried about security, don't: for instance, if you use 
subversion with ssh access (to Novell, for instance) the password is 
stored in clear text in ~/.subversion/auth, and the file is world 
readable! (Was, rather, I changed it). So subversion must be giving the 
password somehow.


You've gotta be kidding.
Someone needs to hit the subversion devs with a clue-bat.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Carlos E. R.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



The Friday 2008-01-25 at 15:54 -0800, Jim Cunning wrote:


Interesting. It might be possible to modify the firmware image before
re-flashing the device, if it is a bootable disk image. For example, the
IPcop router software is available as a bootable image that can be
transferred to a flash card and booted on a diskless system.

What does "file " show?


Well, this router (a comtrend CT536+) gets its image depending on the ISP 
supplying it, and my ISP hasn't published any image, as far as I know. The 
other ISP has, but it is slightly different so I won't flash it with that 
image. And I can not extract the current contents, there is no command for 
it.


I can run 'file' on the other isp flash image, but it says it is just 
data:


[EMAIL PROTECTED]:~/Documentation/PC/router_comtrend/Jazztel> file 
CT-536B-A101-302JAZ-C01_R05.bin
CT-536B-A101-302JAZ-C01_R05.bin: data

I do have the sources, but also for the other provider, and no "making" 
documentation, so I will not try - you know the saying, if it works, don't 
touch it ;-)


It has a kernel 2.4.17 and uses BusyBox v0.60.4, as the log shows:



Apr  9 22:19:26 router BCM96345  started: BusyBox v0.60.4 
(2005.10.07-11:27+)
Apr  9 22:19:26 router klogd: klogd started: BusyBox v0.60.4 
(2005.10.07-11:27+)
Apr  9 22:19:26 router klogd: Total Flash size: 4096K with 71 sectors
Apr  9 22:19:26 router klogd: Scratch pad is not used for this flash part.
Apr  9 22:19:26 router klogd: 96348GW-11 prom init
Apr  9 22:19:26 router klogd: CPU revision is: 00029107
Apr  9 22:19:26 router klogd: Primary instruction cache 16kb, linesize 16 bytes 
(2 ways)
Apr  9 22:19:26 router klogd: Primary data cache 8kb, linesize 16 bytes (2 ways)
Apr  9 22:19:26 router klogd: Linux version 2.4.17 ([EMAIL PROTECTED]) (gcc 
version 3.1) #1 五 10月 7 19:23:37 CST 2005
Apr  9 22:19:26 router klogd: Determined physical RAM map:
Apr  9 22:19:26 router klogd:  memory: 00fa @  (usable)
Apr  9 22:19:26 router klogd: On node 0 totalpages: 4000
Apr  9 22:19:26 router klogd: zone(0): 4000 pages.
Apr  9 22:19:26 router klogd: zone(1): 0 pages.
Apr  9 22:19:26 router klogd: zone(2): 0 pages.
Apr  9 22:19:26 router klogd: Kernel command line: root=/dev/mtdblock0 ro
Apr  9 22:19:26 router klogd: bcm_console_setup
Apr  9 22:19:26 router klogd: Calibrating delay loop... 255.59 BogoMIPS
Apr  9 22:19:26 router klogd: Memory: 14228k/16000k available (1161k kernel 
code, 1772k reserved, 80k data, 48k init, 0k highmem)




- -- 
Cheers,

   Carlos E. R.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD4DBQFHmn80tTMYHG2NR9URAnFJAJiLhn3dnVCJITog1PW9TnTdiXhRAJ0WgvtG
76OAYfbmsBq2imx43sSNfA==
=/FVS
-END PGP SIGNATURE-

Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Jim Cunning
On Friday 25 January 2008 15:08:57 Carlos E. R. wrote:
> The Friday 2008-01-25 at 14:03 -0800, Jim Cunning wrote:
[...]
> > However, it may not be possible to copy his public key to the "'remote'
> > router with embedded" (linux?). Carlos didn't say what limited commands
> > were available, or whether it was even possible to copy files onto the
> > router.
>
> And that is true as well. There is no way I can send any file there; I
> can't even do an 'ls'. I can re-flash it with a new firmware, that's all,
> aside from the allowed configuration parameters. I know it is a linux
> thing by looking at the log and because nmap says so. But none of the
> commands are "shell" commands, it has its own restricted shell.
>
> I can't even change the default or admin user name! It is 1234. Worse, the
> default password is also 1234, and every body knows it, once they know the
> model name. But I have dissabled all type of remote administration except
> from the inside network.
Interesting. It might be possible to modify the firmware image before 
re-flashing the device, if it is a bootable disk image. For example, the 
IPcop router software is available as a bootable image that can be 
transferred to a flash card and booted on a diskless system.

What does "file " show?

Jim
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Carlos E. R.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



The Friday 2008-01-25 at 14:03 -0800, Jim Cunning wrote:


On Friday 25 January 2008 13:25:25 Ken Schneider wrote:

Hans Witvliet pecked at the keyboard and wrote:

On Fri, 2008-01-25 at 14:12 +0100, Carlos E. R. wrote:

[...]

I want to enter an ssh session without having to type the password (to
be used by a script). The "remote" is a router with embedded, and it is
not possible to create public key pairs because it is not a shell, but
one with a limited command set.


As other posters mentioned 'expect' i won't.
But as you specifically mention "ssh" i would rather advise you to
generate a ssh-key-pair and copy the public-one over to the other
machine into the authorizedkeys file.


I would if it were possible.


No asking for pwd's anymore


What part of "it is not possible" is not understood here?


Don't be so quick to be critical. I took Carlos statement to mean it was not
possible on the REMOTE system, but it is certainly possible on his local one,
which is all that is required so far as generating keys goes.


Yes, that's true...


However, it may not be possible to copy his public key to the "'remote' router
with embedded" (linux?). Carlos didn't say what limited commands were
available, or whether it was even possible to copy files onto the router.


And that is true as well. There is no way I can send any file there; I 
can't even do an 'ls'. I can re-flash it with a new firmware, that's all, 
aside from the allowed configuration parameters. I know it is a linux 
thing by looking at the log and because nmap says so. But none of the 
commands are "shell" commands, it has its own restricted shell.


I can't even change the default or admin user name! It is 1234. Worse, the 
default password is also 1234, and every body knows it, once they know the 
model name. But I have dissabled all type of remote administration except 
from the inside network.


- -- 
Cheers,

   Carlos E. R.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQFHmmwJtTMYHG2NR9URAjasAJ9ZAEtJ4bvd7xcU7uF92NQU+k4a0ACgk2gw
ko8cB/DXRdPVApaDdUY+oyU=
=c1Gl
-END PGP SIGNATURE-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Jim Cunning
On Friday 25 January 2008 13:25:25 Ken Schneider wrote:
> Hans Witvliet pecked at the keyboard and wrote:
> > On Fri, 2008-01-25 at 14:12 +0100, Carlos E. R. wrote:
[...]
> >> I want to enter an ssh session without having to type the password (to
> >> be used by a script). The "remote" is a router with embedded, and it is
> >> not possible to create public key pairs because it is not a shell, but
> >> one with a limited command set.
> >
> > As other posters mentioned 'expect' i won't.
> > But as you specifically mention "ssh" i would rather advise you to
> > generate a ssh-key-pair and copy the public-one over to the other
> > machine into the authorizedkeys file.
> >
> > No asking for pwd's anymore
>
> What part of "it is not possible" is not understood here?

Don't be so quick to be critical. I took Carlos statement to mean it was not 
possible on the REMOTE system, but it is certainly possible on his local one, 
which is all that is required so far as generating keys goes.  

However, it may not be possible to copy his public key to the "'remote' router 
with embedded" (linux?). Carlos didn't say what limited commands were 
available, or whether it was even possible to copy files onto the router.

Jim
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Ken Schneider
Hans Witvliet pecked at the keyboard and wrote:
> On Fri, 2008-01-25 at 14:12 +0100, Carlos E. R. wrote:
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>>
>>
>> Hi,
>>
>> I want to enter an ssh session without having to type the password (to be 
>> used by a script). The "remote" is a router with embedded, and it is not 
>> possible to create public key pairs because it is not a shell, but one 
>> with a limited command set.
>>
> 
> As other posters mentioned 'expect' i won't.
> But as you specifically mention "ssh" i would rather advise you to
> generate a ssh-key-pair and copy the public-one over to the other
> machine into the authorizedkeys file.
> 
> No asking for pwd's anymore

What part of "it is not possible" is not understood here?

-- 
Ken Schneider
SuSe since Version 5.2, June 1998
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Hans Witvliet
On Fri, 2008-01-25 at 14:12 +0100, Carlos E. R. wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> 
> 
> Hi,
> 
> I want to enter an ssh session without having to type the password (to be 
> used by a script). The "remote" is a router with embedded, and it is not 
> possible to create public key pairs because it is not a shell, but one 
> with a limited command set.
> 

As other posters mentioned 'expect' i won't.
But as you specifically mention "ssh" i would rather advise you to
generate a ssh-key-pair and copy the public-one over to the other
machine into the authorizedkeys file.

No asking for pwd's anymore
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Carlos E. R.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



The Friday 2008-01-25 at 20:15 +0100, Roger Oberholtzer wrote:


Ignore previous odd post.


:-)


To get you started, there is autoexpect. Check the man page.


Ah!  :-)


Essentially, you do your thing once and autoexpect saves what is needed
to automate it. The script usually needs editing to remove things that
are too specifc. But it does the grunt work. expect does much more than
what these simplistic automated login scripts do. It is worht checking
out. And, it is cross-platform.


Very nice. I did use things like this, time ago, to connect to a BBS 
terminal and fetch my mail package for bluewave. My script was quite 
complicated, but it did it all pretty fast. Nice to know there is a good 
for all program to do that kind of thing in linux.


- -- 
Cheers,

   Carlos E. R.

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQFHmj5RtTMYHG2NR9URAhaPAJoD1a+kkCP4YFNV9CdwI1ocJZM9qACePUJF
wniecgxVubUlrE3KURTrz98=
=Hvw3
-END PGP SIGNATURE-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Ken Schneider
Carlos E. R. pecked at the keyboard and wrote:
> 
> 

> [EMAIL PROTECTED]'s password:
>  ->
> 
> 
> The ping command is not sent... Ah, got it!
> 
> expect "[EMAIL PROTECTED]'s password: "
> send "\n"
> expect " ->"
> send "ping -c 5 192.168.1.12\n"
> interact
> 
> 
> 
>   THANK YOU!   :-)))
> 
> 
> (I need the router to send pings to my PC, or this computer stops
> working - - that's another story, there is a bugzilla about it)
> 
> 

If my failing brain is working right you can also nest "expect"
statements to send different commands depending on what was sent from
the machine you are connecting to. I had to do this with the Cisco
routers because the command prompt was different depending on which
version of the IOS was installed. This way I only needed one script to
cover all of the routers I maintained.

-- 
Ken Schneider
SuSe since Version 5.2, June 1998
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Roger Oberholtzer
Ignore previous odd post.

To get you started, there is autoexpect. Check the man page.
Essentially, you do your thing once and autoexpect saves what is needed
to automate it. The script usually needs editing to remove things that
are too specifc. But it does the grunt work. expect does much more than
what these simplistic automated login scripts do. It is worht checking
out. And, it is cross-platform.

I use expect all the time to do an ssh to a system, and then another ssh
to a system from there. Works every time.


-- 
Roger Oberholtzer

OPQ Systems / Ramböll RST
Ramböll Sverige AB
Kapellgränd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden

Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Roger Oberholtzer
To
-- 
Roger Oberholtzer

OPQ Systems / Ramböll RST
Ramböll Sverige AB
Kapellgränd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden

Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Carlos E. R.

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



The Friday 2008-01-25 at 10:01 -0500, james wright wrote:


On Friday 25 January 2008 08:37:24 am Ken Schneider wrote:



Try using expect to do what you want. I used expect when connecting to
Cisco routers to do configuration changes with the password embedde3d in
the expect script.


Ah, expect! Got the name wrong.


You should obviously read the man page, but if you want to start having fun
right away, paste the below script into a file, change the name, host, and
password to fit your environment and run it with:

expect FileYouSaved

Here is the script:

#!/usr/bin/expect
spawn ssh -l UserNameHere 192.168.1.111
expect Password:
send "PassWord\n"
interact


Note:  You need the \n at the end of your password.



Good! Seems easy... but doesn't quite work. I have:

#!/usr/bin/expect
spawn ssh -l 1234 router
#expect [EMAIL PROTECTED]'s password:
expect Password:
send "password\n"
interact


but I get:

[EMAIL PROTECTED]:~> router_ssh
spawn ssh -l 1234 router
[EMAIL PROTECTED]'s password:


and it doesn't enter. I modify the script:

#!/usr/bin/expect
spawn ssh -l 1234 router
expect [EMAIL PROTECTED]'s password:
send "password\n"
interact


and now I get:

[EMAIL PROTECTED]'s password: invalid command name "password:"
while executing
"password:"
invoked from within
"expect [EMAIL PROTECTED]'s password: "
(file "/home/cer/bin/router_ssh" line 3)


I escape the ' with \ and still I get:


[EMAIL PROTECTED]:~> router_ssh
spawn ssh -l 1234 router
[EMAIL PROTECTED]'s password: invalid command name "password:"
while executing
"password:"
invoked from within
"expect [EMAIL PROTECTED]'s password: "
(file "/home/cer/bin/router_ssh" line 3)


Why is it trying to execute "password"? That's absurd.

Ah! I got it!

expect "[EMAIL PROTECTED]'s password: "



Well... now I want one step more:


#!/usr/bin/expect
spawn ssh -l 1234 router
expect "[EMAIL PROTECTED]'s password: "
#expect Password:
send "\n"
send "ping -c 5 192.168.1.12"
interact



[EMAIL PROTECTED]:~> router_ssh
spawn ssh -l 1234 router
[EMAIL PROTECTED]'s password:
 ->


The ping command is not sent... Ah, got it!

expect "[EMAIL PROTECTED]'s password: "
send "\n"
expect " ->"
send "ping -c 5 192.168.1.12\n"
interact



  THANK YOU!   :-)))


(I need the router to send pings to my PC, or this computer stops working 
- - that's another story, there is a bugzilla about it)



- -- 
Cheers,

   Carlos E. R.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQFHmg8ntTMYHG2NR9URAk/sAKCAY8ieG/08uH8HeItcMjsih1NN6gCfRial
JltnbqyJ9o9SUc3iyeLLZO8=
=eKVD
-END PGP SIGNATURE-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread james wright
On Friday 25 January 2008 08:37:24 am Ken Schneider wrote:
> Carlos E. R. pecked at the keyboard and wrote:
> > Hi,
> >
> > I want to enter an ssh session without having to type the password (to
> > be used by a script). The "remote" is a router with embedded, and it is
> > not possible to create public key pairs because it is not a shell, but
> > one with a limited command set.
> >
> > I can give the user, like:
> >
> > ssh [EMAIL PROTECTED]
> >
> > but I haven't found a way in the man to give also the password, as there
> > is for instance in ftp.
> >
> > I think there is something like chat ? but I'v never used it and I'm
> > unsure how.
> >
> >
> > If any one is worried about security, don't: for instance, if you use
> > subversion with ssh access (to Novell, for instance) the password is
> > stored in clear text in ~/.subversion/auth, and the file is world
> > readable! (Was, rather, I changed it). So subversion must be giving the
> > password somehow.
> >
> > -- Cheers,
> >Carlos Robinson
>
> Try using expect to do what you want. I used expect when connecting to
> Cisco routers to do configuration changes with the password embedde3d in
> the expect script.
>
> --
> Ken Schneider
> SuSe since Version 5.2, June 1998

You should obviously read the man page, but if you want to start having fun 
right away, paste the below script into a file, change the name, host, and 
password to fit your environment and run it with:

expect FileYouSaved

Here is the script:

#!/usr/bin/expect
spawn ssh -l UserNameHere 192.168.1.111
expect Password:
send "PassWord\n"
interact


Note:  You need the \n at the end of your password.
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] How can I give the password to an ssh session on the command line?

2008-01-25 Thread Ken Schneider
Carlos E. R. pecked at the keyboard and wrote:
> 
> 
> Hi,
> 
> I want to enter an ssh session without having to type the password (to
> be used by a script). The "remote" is a router with embedded, and it is
> not possible to create public key pairs because it is not a shell, but
> one with a limited command set.
> 
> I can give the user, like:
> 
> ssh [EMAIL PROTECTED]
> 
> but I haven't found a way in the man to give also the password, as there
> is for instance in ftp.
> 
> I think there is something like chat ? but I'v never used it and I'm
> unsure how.
> 
> 
> If any one is worried about security, don't: for instance, if you use
> subversion with ssh access (to Novell, for instance) the password is
> stored in clear text in ~/.subversion/auth, and the file is world
> readable! (Was, rather, I changed it). So subversion must be giving the
> password somehow.
> 
> -- Cheers,
>Carlos Robinson

Try using expect to do what you want. I used expect when connecting to
Cisco routers to do configuration changes with the password embedde3d in
the expect script.

-- 
Ken Schneider
SuSe since Version 5.2, June 1998
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]