In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you what SSH commands are in Linux, which are concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Basic usage
The simplest use is to enter ssh with no parameters and add the host address, such as:
Ssh 192.168.0.116
If you log in to the host in this way, you will log in using the current user by default. When connecting for the first time, SSH will confirm the authenticity of the target host, and if there is no problem, type yes.
If we want to log in to the host with the specified user name, there are two ways:
a. Use the-l option
Ssh-l alvin 192.168.0.116
b. Use user@hostname format
Ssh alvin@192.168.0.116
Of these two methods, the second is particularly commonly used.
two。 Specify port login
The default port number used by SSH is 22. Most modern Linux systems have port 22 open. If you run the ssh program without specifying a port number, it sends the request directly through port 22.
If we do not want to log in through port 22, we can use the-p option to specify the port.
Ssh 192.168.0.116-p 1234
Extended topic: how to change the port number?
Just modify / etc/ssh/ssh_config by modifying the following line:
Port 22
3. Request compression for all data
Using the-C option, all data sent or received through SSH will be compressed and still encrypted.
Ssh-C 192.168.0.116
However, this option is useful when the network speed is not very fast, and when the network speed is fast, using compression will reduce efficiency, so use it on a case-by-case basis.
4. Turn on debug mode
For some reason, we want to track and debug the SSH connections we have established. The-v option parameter provided by SSH is set for this purpose. It can see where something went wrong.
[Alvin.Alvin-computer] ➤ ssh-v pi@192.168.0.116OpenSSH_7.1p2, OpenSSL 1.0.1g 7 Apr 2014debug1: Reading configuration data / etc/ssh_configdebug1: Connecting to 192.168.0.116 [192.168.0.116] port 22.debug1: Connection established.debug1: key_load_public: No such file or directorydebug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_7.1debug1: Remote protocol version 2.0 Remote software version OpenSSH_7.4p1 Raspbian-10+deb9u4debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u4 pat OpenSSH* compat 0x04000000debug1: Authenticating to 192.168.0.116 as' pi'debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT received
5. Bind source address
If your client has more than two IP addresses, you can't tell which IP to use 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.
[Alvin.Alvin-computer] ➤ ssh-b 192.168.0.105 pi@192.168.0.116Linux raspberrypi 4.14.71 ssh v7 + # 1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7lThe programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in / usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.Last login: Sun Feb 24 08:52:29 2019 from 192.168.0.105
6. Execute command remotely
If we want to execute a command on the target host, our usual practice is to log in to the target host, execute the command, and then exit. Of course it's OK to do so, but it's troublesome.
If we just want to execute a command remotely, we can just follow the command directly, as follows:
[Alvin.Alvin-computer] ➤ ssh pi@192.168.0.116 ls-lDesktopDocumentsDownloadsMagPiMusic
7. Mount a remote file system
Another great SSH-based tool is called sshfs. Sshfs allows you to mount the file system of a remote host directly locally. It is used in the following format:
Sshfs-o idmap=user user@hostname:/home/user ~ / Remote
For example:
Sshfs-o idmap=user pi@192.168.0.116:/home/pi ~ / Pi what is a Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
What are the SSH commands in Linux? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.