0

I'm new to Ubuntu. I want to access a remote server using terminal by using the shortcut key. For example, to access server Y, I will give ssh Y all the time. Just want to write a script to access the server so that I can call it every time and easy to remember. Which file do I need to add the command in?. How to run it after logging into my system?

Wolverine
  • 664

1 Answers1

2

Use ~/.ssh/config:

Add a host:

Host y
  HostName domain.com
  Port 666
  User username
  IdentityFile ~/.ssh/id_rsa-domain

And then access your host from a terminal:

ssh y

Also, you can create a shortcut to your terminal that opens a ssh session right away. Save this to a y.desktop file and place it in your ~/Desktop folder:

[Desktop Entry]
Version=1.0
Name=domain.com
Exec=gnome-terminal -e "bash -c 'ssh y'"
Icon=utilities-terminal
Terminal=false
Type=Application
Categories=Application;

Sure, there are number of ways on how you can bind a shortcut to some actions. The simplest in Unity is to use it's own settings: System Settings -> Keyboard -> Shortcuts -> Custom Shortcuts. You can bind one to execute ssh y.