*I think this is the right place for this if not blast it off in the right direction with *
Okay, here's what I'm trying to do.
I need to ssh into a windows comp (running freeSSHD), from a linux comp... all within a perl script. I had it all worked out save the ssh part.
It kicks me out for the password authentication... I've tried using private/public keys on both, and that seems to hang up somewhere. If I had to guess, I'd say it is because they are different ssh server/clients (openSSH and freeSSHD)... but I really don't know.
Also, with my very limited Internet resources, I can't download a bunch of files (anything over 1-2 MB is really pushing it ... :/ )... so I don't think I'll be able to do NET::SSH::PERL or anything like that from CPAN...
EDIT Okay, so I was not able to install cygwin, because it is an online installer and I have lousy internet, but I did stumble upon a windows port of openssh, that was an offline installer, it is very out of date but I was able to (somehow) get the private key authentication working, so issue solved. /EDIT
Any suggestions?
I've tried things like this...
Code:
$IP = "192.168.1.10";
$ssh = `ssh user@$IP`;
$x = `password`;
#
#And I've tried it with
system("password");
#and even tried it as
$ssh = `ssh user@$IP` . `password`;
If anyone has *any* ideas what-so-ever, it'd be greatly appreciated. Thanks!
Last edited by 9to5cynic; October 30th, 2011 at 10:32 PM.
Reason: code clarity.
You mean with bash or sh? While I know very little about perl, I know less about bash/sh scripting. Am I right to assume that the script would look something like this...
I suppose just directly in a command line - just logging in to the daemon running on the Windows side to make sure it's actually taking the login part - as long as you can look around in the Windows login when logging in from the *nix box then that will rule out a config error on the freeSSHD
The Following User Says Thank You to johnlgalt For This Useful Post:
From terminal without scripts I can log in, it just seems to be whenever I am prompted for a password, the script ends and I'm left putting in the remaining input w/o script assistance.
Here's my latest sh script:
Code:
#!/bin/sh
#
IP="192.168.91.133"
ssh $IP -l sshuser
`password`
`mkdir windowsDir`
#I also tried w/o the ticks, but still kicks me back out...
exit 0
Okay, so I'm reading over the man file for ssh, and I've stumbled upon the -f flag, which seems like it might be a useful option...
Code:
-f Requests ssh to go to background just before command execution.
This is useful if ssh is going to ask for passwords or
passphrases, but the user wants it in the background. This
implies -n. The recommended way to start X11 programs at a
remote site is with something like ssh -f host xterm.
If the ExitOnForwardFailure configuration option is set to “yes”,
then a client started with -f will wait for all remote port for‐
wards to be successfully established before placing itself in the
background.
I'm googleing (googling?) an example, it keeps telling me that in order to fork into the background I need a command to run first... but I'm unaware how to set that command besides from how I have it in the post above.
Thanks johnlgalt for the assistance!
Well, I thought BatchMode was what I needed (it suppresses prompts), but that does nothing for me if I can't get SSH w/o passwords to work cross platform...
Last edited by 9to5cynic; October 30th, 2011 at 12:05 AM.
Reason: BatchMode, not a superhero.
Thanks, but no need. Unless you want to. I got it working by finding an offline installer for openSSH for windows. It is very outdated, but I did manage to get the private keys working (for password-less login).