Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-11-2010, 11:31 AM   #1
LQ Newbie
Registered: Sep 2009
Posts: 7

Rep: Reputation: 0
How can I create a remote login script w/ options

Hello, I am still pretty new to bash scripting so hopefully this is even possible. All day I have to connect to various unix servers via ssh or ovpn. These servers report the current ip hourly to our dns server. I am trying to minimize the few hundred times a day i type ssh myUN@xy1234.mydns etc to connect. 1234 being a store number.

I would like to create a login script that has 2 options. -o = ovpn and -s= ssh. Is this possible.
ssh muUN@xy____.mydns is always used for ssh.
openvpn --remote xy_____.mydns --config client.ovpn is always used for ovpn.

I would like to be able to type something like,
[jim@localhost tools]$ ./login -? 1234
again 1234 being the store number I need to connect to.

Is this possible. Any help is greatly appreciated.....
Old 08-11-2010, 11:40 AM   #2
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Pretty much sounds like you want a script similar to this idea here:

Usually I believe `expect` is installed, so you shouldn't run into the problem that that person is having.

Try to adapt that script to your needs, or use it for ideas. Read the manpage for `expect` and search LQ for other threads about `expect` and if you run into troubles, or you come up with a script but it doesn't quite work as expected (hehe, pun!), then show us what you have, and we 'll try to help you sort out the problems with it.

Note: Please use code tags if/when you post pieces of script, to make it easier to read and retain code formatting. If you're not familiar with code tags, you can read about code tags here:



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script to rsync remote dir with options uopjohnson Linux - General 3 04-23-2010 02:16 AM
a script to create login/day stats, based on output of last wet_weasel Programming 5 12-07-2009 04:33 PM
Is It Possible to write a script which login a remote server senthilvael Linux - Newbie 4 11-21-2007 07:23 PM
shell script for remote ssh login sefaklc Programming 5 08-28-2007 10:03 PM
Create a login script? jedimastermopar *BSD 4 08-02-2004 09:07 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration