Remote Logging Using ssh in Ubuntu

|

The newer, more modern and secure replacement for telnet is ssh, the secure shell application, which uses SSH, the Secure Shell protocol. The ssh application is installed as part of a default Ubuntu Linux installation, along with other applications that use the same protocol and authentication information, and which shares much of the same command-line syntax, such as sftp (secure FTP) and scp (secure copy). Using ssh, you can establish a remote login session on any machine that is running an ssh daemon. An ssh daemon must be running on the remote system. If you try to connect to the remote system and see a message like the following, the ssh daemon is either not running on that system or it is running on some port other than the default port 22:

$ ssh ulaptop
ssh: connect to host ulaptop port 22: Connection refused

Using ssh to connect to a remote system as the current user is as simple as typing the ssh hostname command, where hostname is the name or IP address of the host that you want to connect to. The first time that you attempt to connect to a remote system that you have never connected to before, you will see a message like the following:

$ ssh ulaptop
The authenticity of host ‘ulaptop (192.168.6.90)’ can’t be established.
RSA key fingerprint is 07:e6:3a:50:4b:6d:e6:d8:f1:80:c6:b2:da:02:a3:da.
Are you sure you want to continue connecting (yes/no)?

To continue connecting to this system, type yes and press return. The ssh utility adds the RSA key for the remote system to its list of known hosts (to prevent some other machine from impersonating the remote machine in the future), and prompts you for your password, as in the following example:

Warning: Permanently added ‘ulaptop’ (RSA) to the list of known hosts.
wvh@ulaptop’s password:

RSA stands for Rivest, Shamir, and Adleman, the developers of the type of public key encryption technology that is used by default by the OpenSSH implementation of the SSH protocol. For more information about public key infrastructure (PKI) and related encryption technologies, see a Web site such as Wikipedia’s PKI information at http://en.wikipedia.org/wiki/Pki.

At this prompt, enter your password on the remote system and press return. Assuming that you typed the correct password, you’ll see a successful login message from the remote system, and that system’s prompt will display, as in the following example:

Linux ubuntu32 2.6.15-21-386 #1 PREEMPT Fri Apr 21 16:43:33 UTC 2006

The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
Last login: Wed May 1 20:15:16 2006
wvh@ubuntu32:~$

Once you’ve established an ssh connection to a remote machine, you can do anything from this login prompt that you could do from a direct connect to that machine, including starting graphical applications that display on your local system if you set the DISPLAY environment variable correctly Graphical Environments for Linux working on the remote system, you can log out by pressing Control+D or by typing the exit command.

All of this is well and good assuming that you have the same login name on all of the systems that you want to connect to, or that you always want to connect as yourself. Luckily, the ssh command provides an easy way to connect to another system as another user by using a command such as ssh user@host, where user is the name of the user that you want to log in as, and host is the name of the host to which you want to connect as that user. For example, the command ssh joeuser@ulaptop would use ssh to connect to the remote host ulaptop as the user joeuser. Assuming that you know this user’s password, you can login there as the specified user and perform any actions that they are authorized to do.

The ssh command has many other options, few of which you’ll probably ever need to use. For complete information on the ssh command, see the online reference information for the command that is available through the man ssh command.

Source of Information : Ubuntu Linux - Bible

0 comments:

Subscribe to Computing Tech

Enter your email address:

Delivered by FeedBurner

Add to Technorati Favorites Top Blogs