1

I have to log in to my school's Linux server for homework. I would like to be able to make a script or something for my desktop to save a bit of time (using Ubuntu desktop).

Currently I log in using the following: SSH [email protected]

Would there be a way to automation this task so I can click an icon? Actually while typing this...just thinking, would bashrc be a better way than a script?

3 Answers 3

4

You can use a custom SSH configuration file for making aliases for hosts. Create the ~/.ssh/config file if it does not already exist and add the following:

Host school
    User yourverylonguserid
    HostName your.very.long.school.example.com
    # Optionally, change the port:
    #Port 22

Then, use ssh school to login, you can even omit the user part since it was set in the configuration file. This works for other SSH tools as well, like scp and sshfs.

You're always able to override the settings in the configuration file. If you need to login with another user once (e.g. for testing purposes), you can specify the user to override the user:

ssh testuser@school

For more information, check the manual page of ssh_config(5)

1

You could also setup a password-less SSH login with this question here. And then alias a command and put it in the .bash_aliases file. Something like:

alias school_connect='ssh [email protected]'

and additionally even create a desktop launcher with something like this:

  1. Right-click on the desktop and click create launcher.
  2. Enter a name, like SSH_School_Terminal
  3. In the command field, enter, gnome-terminal -x bash -c "school_connect;bash". Note that command is the alias you created.
  4. Click Ok

Double-clicking the launcher will launch a terminal and connect via SSH to your school.

enter image description here

2
  • hmmm, bash gives me error before the bash prompt==== bash: school_connect: command not found Sep 19, 2011 at 21:11
  • Did you create an alias for the school_connect command? Sep 20, 2011 at 4:18
0

You could make a file with the following contents:

[Desktop Entry]
Name=School Server
Comment=Login to school server using ssh
Exec=ssh [email protected]
Terminal=true
Type=Application
Categories=Development;
StartupNotify=true

call it school-ssh.desktop, and set its 'executable' permission to true. Put it on your desktop, or in ~/.local/share/applications. That way, it will show up in your unity launcher.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .