In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the SSH command under Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.
1. View the SSH client version
Sometimes you need to confirm the SSH client and its corresponding version number. You can get the version number using the ssh-V command. It is important to note that Linux generally comes with OpenSSH: the following example shows that the system is using OpenSSH:
$ssh-V
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
The following example shows that the system is using SSH2:
$ssh-V
Ssh: SSH Secure Shell 3.2.9.1 (non-commercial version) on i686-pc-linux-gnu
2. Log in to the remote host with SSH
When you log in to a remote host using ssh for the first time, a message appears that the host key is not found. After typing "yes", the system will add the key of the remote host to .ssh / hostkeys in your home directory, so you can continue. Examples are as follows:
one
two
three
four
five
six
seven
eight
Localhost$ ssh-l jsmith remotehost.example.com
Host key not found from database.
Key fingerprint:
Xabie-dezbc-manud-bartd-satsy-limit-nexiu-jambl-title-jarde-tuxum
You can get a publickey's fingerprint by running% ssh-keygen-F publickey.pub on the keyfile.
Are you sure you want to continue connecting (yes/no)? Yes
Host key saved to / home/jsmith/.ssh3/hostkeys/key_22_remotehost.example.com.pub hostkey for remotehost.example.com
Accepted by jsmith Mon May 26 2008 16:06:50-0700 jsmith@remotehost.example.com password: remotehost.example.com$
Because the key of the remote host has been added to the list of known hosts of the ssh client, when you log in to the remote host for the second time, you only need to enter the login password of the remote host.
one
two
three
Localhost$ ssh-l jsmith remotehost.example.com
Jsmith@remotehost.example.com password:
Remotehost.example.com$
For various reasons, the key of the remote host may change after you log in for the first time, and you will see some warning messages. There may be two reasons for this:
O the system administrator upgraded or reinstalled the SSH server on the remote host.
O someone is doing some malicious acts, and so on.
Before you type "yes", the best option may be to contact your system administrator to analyze why the host CAPTCHA has changed and check that the host CAPTCHA is correct.
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
Localhost$ ssh-l jsmith remotehost.example.com
@
@ WARNING: HOST IDENTIFICATION HAS CHANGED!
@ @
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the- middle attack)!
It is also possible that the host key has just been changed.
Please contact your system administrator.
Add correct hostkey to-/ home/jsmith/.ssh3/hostkeys/key_22_remotehost.example.com.pub to get rid of this message.
Received server key's fingerprint:
Xabie-dezbc-manud-bartd-satsy-limit-nexiu-jambl-title-arde-tuxum
You can get a publickey's fingerprint by running% ssh-keygen-F publickey.pub on the keyfile.
Agent forwarding is disabled to avoid attacks by corrupted servers.
Are you sure you want to continue connecting (yes/no)? Yes
Do you want to change the host key on disk (yes/no)? Yes
Agent forwarding re-enabled.
Host key saved to / home/jsmith/.ssh3/hostkeys/key_22_remotehost.example.com.pub hostkey for remotehost.example.com
Accepted by jsmith Mon May 26 2008 16:17:31-0700 jsmith @ remotehost.example.com's password: remotehost$
3. Debug SSH client session
When there is a problem with the ssh connection, we need to locate these errors by looking at the debugging information. Generally speaking, you can view debugging information by using the v option (note: it is lowercase v).
Examples of no SSH client debugging information:
one
two
Localhost$ ssh-l jsmith remotehost.example.com
Warning: Connecting to remotehost.example.com failed: No address associated to the name
Examples that contain ssh debugging information:
one
two
three
four
five
six
seven
eight
nine
ten
Locaclhost$ ssh-v-l jsmith remotehost.example.com
Debug: SshConfig/sshconfig.c:2838/ssh3_parse_config_ext:
Metaconfig parsing stopped at line 3.
Debug: SshConfig/sshconfig.c:637/ssh_config_set_param_verbose:
Setting variable climbing / climbing / climbing Mode' to FALSE'.
Debug: SshConfig/sshconfig.c:3130/ssh_config_read_file_ext: Read 17 params from config file.
Debug: Ssh3/ssh3.c:1707/main: User config file not found, using defaults. (Looked for / home/jsmith/.ssh3/ssh3_config')
Debug: Connecting to remotehost.example.com, port 22... (SOCKS not used)
Warning: Connecting to remotehost.example.com failed: No address associated to the name
[note: in many commands, the v option corresponds to verbose, which means detailed information.]
When you log in to the remote host from the local computer using ssh, you may want to switch to the local computer to do something, and then go back to the remote host. At this point, you don't need to break the ssh connection, just follow the steps in point 4:
4. Switch the SSH session with the SSH exit character
This technique is very practical. In particular, remote login to a host A, and then login from A to B, if you want to do some operations on A, you have to open another terminal, which is very troublesome.
When you log in to the remote host from the local computer using ssh, you may want to switch to the local computer to do something, and then go back to the remote host. At this time, you don't need to break the ssh connection, just follow the steps below:
When you have logged in to the remote host, you may want to go back to the local host to do something, and then continue back to the remote host. In this case, there is no need to disconnect the session of the remote host, you can do this in the following ways:
1. Log in to the remote host:
Localhost$ ssh-l jsmith remotehost
two。 Connected to the remote host:
Remotehost$
3. To temporarily return to the local host, enter the exit symbol: "~" combined with "Control-Z".
When you type "~" you will not immediately see it on the screen, but will not display together until you press and press enter. Enter "~" on the remote host as follows
Remotehost$ ~ ^ Z
[1] + Stopped ssh-l jsmith remotehost
Localhost$
4. Now that you have returned to the local host, the ssh remote client session is running in the UNIX background, and you can view it as follows:
Localhost$ jobs
[1] + Stopped ssh-l jsmith remotehost
5. You can switch the ssh session process running in the background to the foreground and return to the remote host without entering a password
Localhost$ fg 1
Ssh-l jsmith remotehost
Remotehost$
5. Use SSH to exit the character session and display the information
To get some useful information about the current session, you can do it in the following ways. However, this can only be used on SSH 2 clients.
Log in to the remote server
Localhost$ ssh-l jsmith remotehost
On the remote server, enter the ssh exit character ~ and enter s as shown below. This will show a lot of useful information about the current ssh connection
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
twenty-one
twenty-two
twenty-three
twenty-four
Remotehost$ [Note: when you type ~ s on the command line, it is not visible.]
Remotehost: remotehost
Localhost: localhost
Remote version: SSH-1.99-OpenSSH_3.9p1
Local version: SSH-2.0-3.2.9.1 SSH Secure Shell (non-commercial)
Compressed bytes in: 1506
Uncompressed bytes in: 1622
Compressed bytes out: 4997
Uncompressed bytes out: 5118
Packets in: 15
Packets out: 24
Rekeys: 0
Algorithms:
Chosen key exchange algorithm: diffie-hellman-group1-sha1
Chosen host key algorithm: ssh-dss
Common host key algorithms: ssh-dss,ssh-rsa
Algorithms client to server:
Cipher: aes128-cbc
MAC: hmac-sha1
Compression: zlib
Algorithms server to client:
Cipher: aes128-cbc MAC: hmac-sha1
Compression: zlib
Localhost$
Thank you for reading this article carefully. I hope the article "how to use SSH commands under Linux" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.