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?
Asked
Active
Viewed 1,044 times
0
-
You can set up bash alias, eg. like in this asnwer – Tomasz Dec 30 '14 at 09:45
1 Answers
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.
Andrejs Cainikovs
- 5,859
-
-
No. I have copied this code from here. I guess changing this to just
ssh ywill work as well. – Andrejs Cainikovs Dec 30 '14 at 13:17