Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 verylongname0434@linux.myschoolslongurl.net

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?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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 verylongname0434@linux.myschoolslongurl.net'

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

share|improve this answer
    
hmmm, bash gives me error before the bash prompt==== bash: school_connect: command not found –  SkinnyGeek1010 Sep 19 '11 at 21:11
    
Did you create an alias for the school_connect command? –  nitstorm Sep 20 '11 at 4:18

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)

share|improve this answer

You could make a file with the following contents:

[Desktop Entry]
Name=School Server
Comment=Login to school server using ssh
Exec=ssh verylongname0434@linux.myschoolslongurl.net
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.