15

I have many remote machines I need to log in. I need somehow store connection parameters because it is too boring enter them manually. Also I prefer to store password in these shortcuts. Software similar MTPuTTY that runs under windows would would solve my problem in Ubuntu.

How to solve this problem?

muru
  • 207,228
vico
  • 4,717
  • 23
  • 66
  • 89

2 Answers2

20

You can do a lot using .ssh/config file. It would allow you to replace this:

ssh fooey@dev.example.com -p 22000

with:

ssh dev

to do so you have to add the following lines at the end of the .ssh/config (create it if does not exist)

Host dev
    HostName dev.example.com
    Port 22000
    User fooey

Concerning the storage of your credentials, I strongly advise you to use key authentification instead of password based. You can create them either with a GUI or with your terminal.

GUI

open Seahorse, select File > New, then Secure Shell Key and let the interface guide you

Terminal Create you RSA key pair:

ssh-keygen -t rsa

Store the Keys and Passphrase:

Enter file in which to save the key (/home/demo/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):

Copy the Public Key

ssh-copy-id fooey@dev.example.com

Sources:

muru
  • 207,228
Louis Soulez
  • 2,990
  • 2
  • 14
  • 9
5

If you wanted to, you could make short shell scripts to launch your ssh sessions, then execute them either as s executable ( chmod o+x), or using the dot . command

Like make a file ~/ssh2hostA.sh

#!/bin/sh
sshpass -p 'yourpassword' ssh user@hostA

then start it with

. ~/ssh2hostA.sh

Which is not a good thing to do because not only do you have passwords in cleartext scattered in your files, but people will probably be able to see the password in the w command. ( and top, and /proc)

Really, you should be using ssh host keys for this.

Really.

infixed
  • 165