LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Automating the SSH Login Process. (https://www.linuxquestions.org/questions/linux-newbie-8/automating-the-ssh-login-process-908387/)

pikohn 10-15-2011 11:06 PM

Automating the SSH Login Process.
 
Hello all Linux Gurus,


I am trying to make a batch script that will automatically setup up an SSH Tunnel so that I may filter my web traffic. I'm a little paranoid about putting my password in a plain text file. Is there another way to automate the process so all I would have to do is double click a script to start the tunnel?

It's late so if you need clarification just ask.

Thanks to all that reply.

Mike

btmiller 10-15-2011 11:09 PM

Use key based authentication instead of passwords. If you Google for "ssh key based authentication" or similar, you should find a number of sites telling you how to do it. You'll need to use ssh-keygen to generate your keys.

vasile002 10-16-2011 04:11 AM

Here's how to use rsa key auth
http://news.softpedia.com/news/How-t...on-38599.shtml

pikohn 10-16-2011 12:23 PM

is there any way write a script that will enter a pass phrase, but somehow encrypt it so prying eyes can't figure it out?

vasile002 10-17-2011 12:12 PM

well you could write the script in C and compile it into a binary, that should provide some protection

MANOHARNLINUX 10-17-2011 12:15 PM

You can also try 'expect' script. Using which you can automate ssh login process.
No need to configure any ssh key authentication. Password change doesn't effect unless you maintain right password to be passed during expect script trigger.

You can also try tcl/tk program.

anomie 10-17-2011 12:58 PM

Quote:

Originally Posted by pikohn
is there any way write a script that will enter a pass phrase, but somehow encrypt it so prying eyes can't figure it out?

If you encrypt the passphrase, you have to keep the encryption key somewhere, right?

As mentioned, expect(1) is an option (but it requires a password in clear text). Another option is pubkey authentication + ssh-agent(1).

---

After reading some of the other replies:

Yes, you could lock this away in a compiled binary and set appropriate file permissions. That should discourage the majority of (certainly not all) folks.

pikohn 10-17-2011 08:42 PM

Thanks again for helping me out with this...SSH agent seems like a winner. :)


All times are GMT -5. The time now is 11:16 AM.