博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Using SSH on Linux
阅读量:5240 次
发布时间:2019-06-14

本文共 5393 字,大约阅读时间需要 17 分钟。

This document covers the SSH client on the Linux Operating System and other OSes that use OpenSSH.

What is SSH?

There are a couple of ways that you can access a (command line) remotely on most Linux/Unix systems. One of the older ways is to use the telnet program, which is available on most network capable operating systems. Accessing a shell account through the telnet method though poses a danger in that everything that you send or receive over that telnet session is visible in plain text on your local network, and the local network of the machine you are connecting to. So anyone who can "sniff" the connection in-between can see your username, password, email that you read, and commands that you run. For these reasons you need a more sophisticated program than telnet to connect to a remote host.

SSH, which is an acronym for Secure SHell, was designed and created to provide the best security when accessing another computer remotely. Not only does it encrypt the session, it also provides better authentication facilities, as well as features like secure file transfer, X session forwarding, port forwarding and more so that you can increase the security of other protocols. It can use different forms of encryption ranging anywhere from 512 bit on up to as high as 32768 bits and includes ciphers like AES (Advanced Encryption Scheme), Triple DES, Blowfish, CAST128 or Arcfour. Of course, the higher the bits, the longer it will take to generate and use keys as well as the longer it will take to pass data over the connection.

File:Telnet-Client-server-unencrypted.png File:SSH-client-server-encrypted.png

These two diagrams on the left show how a telnet session can be viewed by anyone on the network by using a sniffing program like Ethereal (now called Wireshark) or tcpdump. It is really rather trivial to do this and so anyone on the network can steal your passwords and other information. The first diagram shows user jsmith logging in to a remote server through a telnet connection. He types his username jsmith and password C0lts06!, which are viewable by anyone who is using the same networks that he is using.

The second diagram shows how the data in an encrypted connection like SSH is encrypted on the network and so cannot be read by anyone who doesn't have the session-negotiated keys, which is just a fancy way of saying the data is scrambled. The server still can read the information, but only after negotiating the encrypted session with the client.

Get started with SSH

Chances are that if you are using a version of Linux that was released after 2002, that you already have OpenSSH installed. The version of SSH that you will want to use on Linux is called OpenSSH.

OpenSSH can be obtained from

To really make ssh useful, you need a shell account on a remote machine, such as on a account.

The first thing we'll do is simply connect to a remote machine. This is accomplished by running 'ssh hostname' on your local machine. The hostname that you supply as an argument is the hostname of the remote machine that you want to connect to. By default ssh will assume that you want to authenticate as the same user you use on your local machine. To override this and use a different user, simply use remoteusername@hostname as the argument. Such as in this example:

ssh username@username.suso.org

 The first time around it will ask you if you wish to add the remote host to a list of known_hosts, go ahead and say yes.

The authenticity of host 'arvo.suso.org (216.9.132.134)' can't be established.RSA key fingerprint is 53:b4:ad:c8:51:17:99:4b:c9:08:ac:c1:b6:05:71:9b.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'arvo.suso.org' (RSA) to the list of known hosts.

 It is important to pay attention to this question however because this is one of SSH's major features. Host validation. To put it simply, ssh will check to make sure that you are connecting to the host that you think you are connecting to.

Ending your SSH session

All good things come to an end. And there are many common ways to end your SSH session.

exit
logout
(Ctrl-d)

 The last one is actually the user pressing the 'Ctrl' key and the letter 'd' at the same time. These all are ways of terminating the SSH session from the server side. They usually exit the shell which in turn logs you off the machine.

What you may not know, is that there is another way to close an SSH session. This is useful if you lose connectivity with the machine and you have no way of ending your shell session. For example, this happens momentarily if you stay logged into a machine while it is shutdown. SSH has its own command line escape sequences. These can be used to end connections, create new port forwards or list current ones and a few other functions. To end a connection even when you don't have a command prompt, type return twice (for good measure) and then the sequence '~.'. That's a tilde followed by a period.

(RETURN) (RETURN) ~.

 This will terminate the SSH connection from the client end instead of the server end.

Happy SSH'ing!

Reference:

This article is one of the top tutorials covering SSH on the Internet. It was originally written back in 1999 and was completely revised in 2006 to include new and more accurate information. As of October, 2008, it has been read by over 473,600 people and consistently appears at the top of Google's search results for SSH Tutorial and Linux SSH.

转载于:https://www.cnblogs.com/casperwin/p/6045650.html

你可能感兴趣的文章
python学习笔记3-列表
查看>>
程序的静态链接,动态链接和装载 (补充)
查看>>
关于本博客说明
查看>>
C++11 生产者消费者
查看>>
IO multiplexing 与 非阻塞网络编程
查看>>
hdu4105  Electric wave
查看>>
基于内容的图片检索CBIR(Content Based Image Retrieval)简介
查看>>
线程androidAndroid ConditionVariable的用法
查看>>
程序电脑VS2008 应用程序配置不正确,未能启动该应用程序。重新安装程序可以修复此问题。解决方法...
查看>>
设置类UIColor使用colorWithRed定义颜色
查看>>
文件语音识别Google语音识别学习札记 - Windows PC机上测试语音识别Strut2教程-java教程...
查看>>
μC/OS-III---I笔记13---中断管理
查看>>
:after,:before,content
查看>>
FTTB FTTC FTTH FTTO FSA
查看>>
OpenAI Gym
查看>>
stap-prep 需要安装那些内核符号
查看>>
网易杭研后台技术中心的博客 -MYSQL :OOM
查看>>
第二章 数据通信的基础知识 计算机网络笔记 学堂在线 2.1 数据传输系统 2.2 信号...
查看>>
如何解决click事件的重复触发问题
查看>>
2016寒假自学笔记
查看>>