Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the SSH command

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to use the SSH command". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use the SSH command" can help you solve the problem.

1. The easiest way to connect to a remote host using ssh is to specify a user name and hostname parameter, which can be an IP address or a domain name. $ssh user@hostname2,ssh connects to other ports SSH connects to port 22 of the target host by default, you can use the-p option to specify the port number $ssh-p 10022 user@hostname3, use ssh to execute a command on the remote host and display it to the local, then continue to work locally and connect directly and add the command to be executed later on $ssh pi@10.42.0.47 ls-L4 Run a graphical program on the remote host using the-X option of ssh, and then the host will turn on the X11 forwarding function $ssh-X feiyu@222.24.51.1475. How to configure the SSHSSH configuration file in / etc/ssh/sshd_config, you can see the port number, idle timeout and other configuration items. 6. The ssh-keygen-t + algorithm is used to build ssh key pairs, and now most of them use rsa or dsa algorithm. $ssh-keygen-t rsa7, check whether the key usage of the corresponding host has been added-F option $ssh-keygen-F 222.24.51.1478, delete the host key use-R option, or manually delete $ssh-keygen-R 222.24.51.1479 in the ~ / .ssh/known_hosts file. Bind the source address if your client has more than two IP addresses It is impossible to tell which IP you are using to connect to the SSH server. To resolve this situation, we can use the-b option to specify an IP address. This IP will be used as the source address to establish the connection. $ssh-b 192.168.0.200 root@192.168.0.10310, use the-C option for all data requests to compress, and all data sent or received through SSH will be compressed and still encrypted. Ssh-C root@192.168.0.10311, turn on debug mode for some reason, we want to track and debug the SSH connections we made. The-v option parameter provided by SSH is set for this purpose. It can see where something went wrong. $ssh-v root@192.168.0.103

Attached: "/ etc/ssh/sshd_config configuration file details"

Port 2 "Port" sets the port number for sshd snooping. ListenAddress 192.168.1.1 "ListenAddress" sets the IP address bound to the sshd server. HostKey / etc/ssh/ssh_host_key "HostKey" sets the file that contains the computer's private key. ServerKeyBits 1024 "ServerKeyBits" defines the number of digits of the server key. LoginGraceTime 600 "LoginGraceTime" sets the amount of time (in seconds) that the server will have to wait before the user is disconnected if the user cannot log in successfully. The parameter ClientAliveInterval 300 (default is 0) means that every 5 minutes, the server sends a message to the client to keep the connection KeyRegenerationInterval 3600 "KeyRegenerationInterval" setting the number of seconds after which the server's key is automatically regenerated (if the key is used). The purpose of regenerating the key is to prevent the stolen key from being used to decrypt the intercepted information. PermitRootLogin no "PermitRootLogin" sets whether root can log in with ssh. This option must not be set to "yes". The IgnoreRhosts yes "IgnoreRhosts" setting verifies whether "rhosts" and "shosts" files are used. IgnoreUserKnownHosts yes "IgnoreUserKnownHosts" sets whether ssh daemon ignores the user's "$HOME/.ssh/known_hosts" StrictModes yes "StrictModes" setting ssh checks the permissions and ownership of the user's home directory and rhosts files before receiving login requests. This is usually necessary because beginners often set their directories and files so that anyone has write access. X11Forwarding no "X11Forwarding" setting whether X11 forwarding is allowed. PrintMotd yes "PrintMotd" sets whether sshd displays the information in "/ etc/motd" when the user logs in. SyslogFacility AUTH "SyslogFacility" sets whether to give "facility pre" when logging messages from sshd. LogLevel INFO "LogLevel" sets the level at which sshd log messages are logged. INFO is a good choice. Check out sshd's man help page for more information. The RhostsAuthentication no "RhostsAuthentication" setting is sufficient to use only rhosts or "/ etc/hosts.equiv" for security verification. The RhostsRSAAuthentication no "RhostsRSA" setting allows security authentication with rhosts or "/ etc/hosts.equiv" plus RSA. Whether the RSAAuthentication yes "RSAAuthentication" setting allows only RSA security authentication. Whether the PasswordAuthentication yes "PasswordAuthentication" setting allows password authentication. PermitEmptyPasswords no "PermitEmptyPasswords" sets whether to allow login with an account with an empty password. This is the end of the introduction to "how to use the SSH command". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report