I have heard of the word ssh before I learned Linux. I learned the three major j2ee frameworks, so when I heard about ssh, I immediately thought of struts + spring + hibernate, at that time, I was thinking that this is not a java thing? Why is it related to Linux ??? Later on Baidu's ssh, we found that ssh is not a general term for the three frameworks, but a security protocol, short for Secure Shell... It seems that my ink is still too small... There are too many things to learn ....
SSH (short for Secure Shell) is developed by the Network Working Group of IETF. SSH is a security protocol built on the application layer and transport layer. SSH is a reliable protocol designed for remote logon sessions and other network services. Traditional remote network services such as ftp and telnet are inherently insecure because they transmit passwords and data in plaintext over the network, people with ulterior motives can easily intercept these passwords and data. If a third-party counterfeit server receives plain text data from us, a serious problem may occur. However, by using SSH, You can encrypt all transmitted data, so that malicious users cannot perform such attacks and prevent DNS Spoofing and IP spoofing. Another advantage of using SSH is that the data transmitted is compressed, which can speed up transmission. SSH has many functions. It can replace Telnet, and provide a secure "channel" for FTP, POP, and even PPP ".
Currently, the ssh protocol is compatible with SSH1 and SSH2. Currently, the main software that implements SSH1 and SSH2 protocols is OpenSSH and SSH Communications Security Corporation's SSH Communications software. The former is a free SSH software developed by the OpenBSD organization, and the latter is a commercial software. Therefore, in linux, FreeBSD, OpenBSD, NetBSD, and other free UNIX-like systems, openSSH is used as the implementation software for SSH protocol.
SSH is installed in all Linux versions. The default value is OpenSSH. You can run the ssh-V command to view the installed ssh version:
[root@xiaoluo xiaoluo]# ssh -VOpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
From the above information, we can see that the SSH protocol installed on CentOS6.4 is 1.0 by default.
So what can we do with SSH? Why do Linux programmers have to learn to use SSH?
Before SSH is available, if we want to share files on Linux and Windows operating systems, we simply mount the optical drive to the Linux system, or you can share files by installing the Samba server (CentOS (11) -- installation and configuration of the Samba server under CentOS6.4). If you want to upload and download files, you need to install FTP, which is very troublesome. For example, my Linux system is a remote server. Many programmers need to upload files to the Linux system after programming, but I cannot allow every user to log on to the remote Linux server. What should I do? Then we can solve the problem by using ssh. ssh is similar to the telnet program on our windows operating system and can remotely log on to the remote server, after logging on to the remote Linux server through ssh, we can perform operations on it like logging on to the Linux system, at the same time, file upload and download can be easily done. We can say that before learning SSH, Ftp and Samba must be mastered, but after learning SSH, these servers are all on the cloud .......
We have installed the ssh server in Linux. We just passed the ssh-V command to view the version of the ssh server installed on our system, therefore, we do not need to install the ssh server. in Linux, the service name of the ssh server is sshd, run the chkconfig -- list | grep sshd command to check the startup status of the sshd service.
[Root @ xiaoluo] # chkconfig -- list | grep sshdsshd 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable
By default, the sshd service starts when the Linux system is started. We don't need to change it. Because ssh is also a network service, it is bound to a port number. In Linux, the port number bound to the ssh service is 21, we can run the netstat-anp | grep sshd command to check the port number bound to the sshd service:
[root@xiaoluo xiaoluo]# netstat -anp | grep sshdtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2140/sshd
Because the ssh server is installed on Linux, if you want to log on to this server remotely, for example, if you want to remotely log on to ssh on windows, we have to install an ssh client on windows. There are a lot of software on the ssh client. You can choose to download it, for example:
Absolute Telnet (http://www.celestialsoftware.net /)
Putty (http://www.putty.org /)
Xshell4 (http://www.netsarang.com/products/xsh_overview.html)
Here I use Absolute to Telnet the ssh client.
Note:: When Using ssh to log on to a remote Linux system, you must first ensure that the host can be pinged with the Linux system. Otherwise, ssh cannot establish a remote connection.
Open our Absolute Telnet client and go to the main interface.
Enter the Enter key on the page or select File> connection to bring up the connection box.
In this box, we can set some attributes of this remote access, such as the background color, character encoding, and font. ClickConnectionOption to enter the connection information filling Interface
Here, we need to enter the IP address of the Linux system that we need to remotely log on to (you can view it through the ifconfig command), and then click OK
In this interface, we select the logon method. Here we choose to log on with a password, and then fill in the username and password we want to log on to remote Linux (Note: if this is the first time you log on with this user, the system will prompt you to generate a key. Click OK)
At this time, we found that we have logged on to the remote Linux system through the root account. The operations here are exactly the same as those on the terminal on the Linux system. You can run the top command to view the users logged on to the Linux system:
We found that we have logged on to three users (because xiaoluo and root users have been logged on to the Linux system on my virtual machine, the third user has just logged on to the root account through ssh)
At this time, we can certainly log on to a user again by running the Absolute Telnet client again. Why is the Linux system a multi-user operating system? It is reflected in this. On Linux, We can log on to multiple users to access their systems.
File Upload, download, and file sharing ???? It is more convenient on ssh.
Click the SFTP button to go to the file upload page (Note:: The client that I use Absolute Telnet. If you want to upload files, you must log in to the root account when establishing a connection. Otherwise, the system will prompt that you have insufficient permissions when uploading files)
That's right. Your Windows operating system directory structure is on the left, and your Linux operating system directory structure is on the right. Do you want to upload files from Windows to Linux? Or upload things from Linux to Windows? So easy... Select a file and drag it !!!!! At this point, we enter the corresponding directory, and the file is already under the directory ...... So why should every Linux programmer learn ssh .... With ssh, all samba servers are on the cloud and can be discarded ...........
Today, I finally learned the benefits of ssh !!!!!!!!!!!!!!!!!!!
This article mainly records some preliminary knowledge of ssh, and will continue to record your learning experience in Linux later !!!