RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

Avoiding tedious remote login ssh syntax

Article Index
1. Create an alias by editing .bashrc file
2. Create a symlink to ssh custom ssh script

Although you have exchanged public keys with your remote server to avoid that boring bit of entering your super long secure user password everytime you are about to login, you still need to face ssh syntax in order get someting done. Yes, it is just single line command with few words but typing that line 30 times a day can take you at least 10 minutes of problem solving time, bore you and more iportatbly it may even give you a headache. This article outlines two alternative options on how to make ssh login procedure easier and thus keeping you sane longer.

1. Create an alias by editing .bashrc file

Let's create a ssh alias which allows us to ssh login to remote server ( example: linuxconfig.org on port 2222 ) with a single command. Open .bashrc file with your favourite text editor and append a folloiwng line:

alias lconfig='ssh -p 2222 linuxconfig.org'

Your new alias will be activated when you create a new shell session. Therefore, open up new terminal ( or logout and login ) and enter lconfig command to login to your remote server. If you have successfuly exchanged your public keys with a remote server you should be able login to your remote server in no time.

2. Create a symlink to ssh custom ssh script

Second option is little bit more tricky but at the same time it also allows us to execute any commands on a remote server directly from local shell. First, create a bash script with following two lines:

#/bin/bash
ssh `basename $0` $*

Login as a root make this script executable and copy this script into /usr/local/bin directory:

# chmod +x /tmp/ssh-autologin.sh
# cp /tmp/ssh-autologin.sh /usr/local/bin/

Now, create a symbolic link to your script where the name of your new symbolic link will be an IP address or hostname of your remote server:

# ln -s /usr/local/bin/ssh-autologin.sh /usr/local/bin/linuxconfig.org

or create IP address symlink:

# ln -s /usr/local/bin/ssh-autologin.sh /usr/local/bin/8.8.8.8

Ensure that /usr/local/bin directory is in your PATH by:

$ echo $PATH

If you need to add /usr/local/bin directory to your path follow this simple ENV PATH how to. All set and ready. To login to your remote server simply enter command:

$ linuxconfig.org

To see who is online on your remote server with an IP 8.8.8.8 without actual ssh login enter:

$ 8.8.8.8 who

The command above will create ssh connection, execute "who" command on a remote server, print the output on your local terminal and logout.

Share this linux post:

Submit Avoiding tedious remote login ssh syntax  in Delicious Submit Avoiding tedious remote login ssh syntax  in Digg Submit Avoiding tedious remote login ssh syntax  in FaceBook Submit Avoiding tedious remote login ssh syntax  in Google Bookmarks Submit Avoiding tedious remote login ssh syntax  in Stumbleupon Submit Avoiding tedious remote login ssh syntax  in Technorati Submit Avoiding tedious remote login ssh syntax  in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download