Well you need to either enter a password or setup key-based
authentication so you don’t need to setup a password. If you haven’t
done that before it’s fairly simple. On your client machine run:
ssh-keygen -t rsa -b 2048
Press [enter] through all the prompts. Note it’s a good idea to have a
passphrase but for this demo we’ll skip it… just know it’s a security
risk and you should add it later and use ssh-agent to cache it for you.
Copy ~/.ssh/id_rsa.pub to the remote machine’s and user’s
~/.ssh/authorized_keys file. You can possibly do this with ssh-copy-id
if you have a current version of SSH. This will copy the public key to
the remote computer. Now just run ssh-add to load in your private key
on the client side and then run your command again and you should not be
prompted for a password. Also you can then add ‘rdesktop
localhost:3390’ on the next line, perhaps after a sleep statement since
you can now background your SSH client’s invocation as you mentioned
before, and get in all at once.
As a note, any reason you aren’t using port 3389 on the local side?
Also where you have ‘-C localaddress’ I assume you mean ‘-C
remoteaddress’ where ‘remoteaddress’ is the remote SSH server.
> Hello All,
> I have a script to create the ssh tunnel to the remote host, which
> forwards the appropriate port onward, so that I can connect to the RDP
> on the Windows machine from my SUSE box, as such
> #! /bin/bash
> ssh -L 3390:remoteaddress:3389 -C localaddress -l username
> Simple enough script, but here’s the kicker-- the script, as such,
> takes over the terminal window with the Windows shell prompt.
> I tried to append a “&” to the end of the script, but that won’t fly.
> This has the interactive element of entering the password to the Windows
> box, also.
> What I want the script to ultimately do is ssh in and invoke a saved
> session for rdesktop. I feel a little silly saying “Is this possible”,
> but…is this possible?
> Any help is much appreciated.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
Thanks for the reply, that is just what I was looking for. However, I am having a problem with ssh-add.
I have tried it with no params, or with -C /home/me/.ssh/id_rsa.pub
and I get a return of 2 "Could not open a connection to your authentication agent. <edit>Just got this to work on SUSE with “exec ssh-agent bash”</edit> Still, I get the same 2 return in Windows- could not open.
Any tips? I got the ssh-copy-id to work, and the key is now on the remote host, but I am still getting a password prompy, even with an “-A” switch in the script.
And yes, I had the addresses backwards in the above code :shame: