Cloud Computing: A Look on Telnet and SSH

Telnet: Traditional way to connect Remote Host

Overview,

  • Telnet is an OSI Application Layer protocol used to provide a bidirectional interactive text-oriented communication facility over network using a virtual terminal connection.
  • Telnet provids access to a command-line interfaceof an operating system on a remote host/router.
  • Telnet uses TCP port 23 by default.

Generally,

  • The term telnet is used to refer to the software that implements the client part of the protocol.
  • The term telnetd is used to refer to the software that implements the server part of the protocol.

Installation,

  • Execute $> sudo apt-get install telnetd in case of Ubuntu and $> sudo yum install telnetd in case of Centos to install telnet server on remote host.
  • For client, use telnet commnad , a built-in telnet client, from host you want telnet to server.

Now you can establish remote connection using command,

  • $> telnet remote_host/ip 23

Then you will get a terminal session to remote host’s terminal where you can execute any comand for remote host.

Disadvantag,

  • Accessing a remote terminal through telnet program is unsecure since everything that you send or receive over that telnet session is visible in plain text. So anyone who can “sniff” (eg. using tools like Wireshark or tcpdump) the connection in-between can see your stuffs.
  • For this reason we need a more sophisticated program than telnet to connect to a remote host, ie. SSH :) .
  • N/W administrator can use tcpdump for capturing packtes and Wireshark to view/analyse the packets. eg. tcpdump port 23 -w dump.txt and wireshark dump.txt

SSH: Modern way to connect Remote Host

Overview,

  • SSH provides encrypted session, authentication facilities, secure file transfer(SCP|sftp), X session forwarding, and port forwarding etc.
  • SSH is an OSI Application Layer protocol used to provide a bidirectional interactive text-oriented communication facility over network using a virtual terminal connection.
  • SSH provids access to a command-line interfaceof an operating system on a remote host/router.
  • SSH uses TCP port 22 by default.

Generally,

  • The term ssh is used to refer to the software that implements the client part of the protocol.
  • The term sshd is used to refer to the software that implements the server part of the protocol.

Installation,

  • Execute $> sudo apt-get install openssh-client in case of Ubuntu and $> sudo yum install openssh-client in case of Centos to install telnet server on remote host.
  • Execute $> sudo apt-get install openssh-server in case of Ubuntu and $> sudo yum install openssh-server in case of Centos to install telnet server on remote host.
  • Generate private and public key using $> ssh-keygen -t rsa
  • Copy your public key to server using $> ssh-copy-id user@remotehost
  • Change the permission using $> chmod 600 .ssh/authorized_keys

Now you can establish remote connection using command,

  • $> ssh -i private_key user@remote_host Then you will get a terminal session to remote host’s terminal where you can execute any comand for remote host.

More on SSH,

X11 Session Forwarding using SSH

  • Using this feature of SSH, it’s possible to transmit window and bitmap information over a network connection. So you can login to a remote desktop and run some X windows program like Firefox and the program will run on the remote computer, but will display its graphical output on your local computer.
  • For this, $> ssh -X user@remotehost where -X option is for X11 session forwarding.

TCP Port Forwarding

You can setup a port forward from your localhost to remotehost so that it will take connections to localhost port 3306 and forward them to the remote side port 3306. This way MySQL server would allow you to run GUI MySQL programs on your local computer while using the database on your remotehost.

Here is the command to accomplish this:

$> ssh -L 3306:mysql.remotehost:3306 user@remotehost

The -L (Local port) takes one argument of
<local-port>:<connect-to-host>:<connect-to-port>

This is a kind of VPN connection.

Running Shell script/commands on Remote Host

Sometimes you don’t really want to run a shell like Bash on the host you are connecting to. Maybe you just want to run a command and exit. This is very simply accomplished by putting the command you wish to run at the end of your ssh connection command.

$> ssh user@remotehost "ls -l /"

Or more conveniently,

$ ssh -i /path_to_private_key -o ConnectTimeout=10 -o ServerAliveInterval=60
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/ null
-o StrictHostKeyChecking= no
user@remotehost "your script or commands to be executed on remote host"

Screen Tool with SSH for remote connection management

This tool can be your best friend if you are remote administrator or you work on remote terminal for long time. This helps to maintain multiple remote session on single screen and can be resumed the session even after connection disruption.

Installation:
Ubuntu: $> sudo apt-get install screen
CentOS: $> sudo yum install screen

Commands,

$> screen to open the screen
$> exit to quit screen
$> screen -S name_of_screen to open the named screen
$> screen -ls to see the list of screens


Ctrl a" "d" to detach from screen
$> screen -rx name_of_screen to reattach the already created screen


Ctrl a" "c" to create a tab inside the screen

"Ctrl-a" "n" to switch between tabs of same screen

29 comments

I must thank you for the efforts you have put in penning this site. I am hoping to check out the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal blog now..

Linux Training in Chennai

Really nice and definitely it will be useful for many people. Kindly keep update like this.

SAS Training in Chennai

Great site for these post and i am seeing the most of contents have useful for my Carrier.Thanks to such a useful information.Any information are commands like to share him.

Branding Services in Chennai

This comment has been removed by the author.

Good explanation of the topic
Sanjary Kids is one of the best play school and preschool in Hyderabad,India. Give your child the best preschool experience by choosing the best playschool of Hyderabad in Abids. we provide programs like Play group,Nursery,Junior KG,Senior KG,and provides Teacher Training Program.
pre and primary teacher training course in hyderabad

This comment has been removed by the author.

Thanks for sharing
Yaaron Studios is one of the rapidly growing editing studios in Hyderabad. We are the best Video Editing services in Hyderabad. We provides best graphic works like logo reveals, corporate presentation Etc. And also we gives the best Outdoor/Indoor shoots and Ad Making services.
Best video editing services in Hyderabad,ameerpet
Best Graphic Designing services in Hyderabad,ameerpet­
Best Ad Making services in Hyderabad,ameerpet­

Students अपने विश्वविद्यालयों के Results के बारे में नवीनतम अपडेट की जाँच करें। Timetable-Result.com यह साइट आपकी सभी क्वेरी को समझने में मदद करेगी है।
BA Exam result Part 1st, 2nd, Final Year
BCom Exam result 1st, 2nd, 3rd semester