This is a newer version of my SSH Starter script.
A small Expect script which will start SSH sessions with automatically entered password.
You can specify hostname, password, port and username inside the script for 4 different servers.
"ssh.sh" - When 97% of your keyboard is broken...
Tested on Ubuntu 16.04 and 14.04
This script also features CLI arguments so you can connect to your server instantly without getting prompted to choose a server.
Usage:
$ ./ssh.sh 1
$ ./ssh.sh 2
$ ./ssh.sh 3
$ ./ssh.sh 4
Extra feature: You can pass a command as argument, which will be executed after login!
Example Usage:
$ ./ssh.sh 1 echo hello
This will execute echo hello
once the login was sucessful.
expect "assword:"
on Line 67 is not a typo.
It matches "Password" as well as "password".
-
Install expect script
$sudo apt-get update
$sudo apt-get install expect
-
Clone and navigate to this repository
$git clone https://github.com/NullDev/SSH-Starter.git && cd SSH-Starter
-
Move the script wherever you want
$mv ssh.sh ..
-
Edit the script as you need it
$cd .. && nano ssh.sh
-
Make the script executable
$chmod +x ssh.sh
-
Thats it! You can either start in from the terminal with
$./ssh.sh
Or by doubleclicking it!
If you do not want to store your password in the script directly, you could create a passwor file. Lets say you create a file called "p" in your home directory and store the password there. Then you can use
set SERVER_1_PKEY [exec cat ~/p]
instead of
set SERVER_1_PKEY "password1"
on Line 9 to 12.
However, this does not provide additional security (It isn't even security through obscurity). This is just for storing the password somewhere else instead of directly inside the script.
Screenshot