Linux SSH (Secure Shell Protocol) service, sshsecure
Before data transmission, SSH encrypts the data to be transmitted to ensure session security and data transmission security. The SSH client also contains a remote copy scp.
1. SSH Structure
The SSH service is composed of the server software (openssh) and clients (SSH, SecureCRT, and Xshell). SSH uses port 22 by default. The SSH Server is a daemon and listens to client requests at any time in the background, sshd is the process name on the SSH server.
Supplement: (daemon process)
A daemon is a process that runs in the background and is not controlled by any terminal. The Unix operating system has many typical daemon processes (the number may vary from 20 to 50). They run in the background and execute different management tasks. The user makes the daemon independent from all terminals because, when the daemon starts from one terminal, the same terminal may be used by other users. For example, the user logs out after starting the daemon process from a terminal and then another user logs on to the terminal. The user does not want the latter to receive any errors of the daemon process while using the terminal. Similarly, any signal (such as the interrupt signal) initiated by the terminal contact should not affect the operation of any daemon process previously started on the terminal. Although it is easy for the server to run in the background (as long as the shell command line ends with "&"), you should also do some work so that the program itself can automatically enter the background without relying on any terminal. The daemon does not have a control terminal. In some cases, either general reporting information or urgent information that needs to be handled by the administrator needs to be output in some way. The Syslog function is a standard method for outputting such information. It sends the information to the syslogd daemon.
2. SSH Authentication Type
(1) password-based security verification, that is, account, password, port, and IP Login
(2) Key-based security verification
Create a key pair in advance, put the public key on the server, put the private key on the SSH client, and finally encrypt and transmit data through this key verification method.
3. SCP
NAME scp-secure copy (remote file copy program) # securely copy SYNOPSIS scp [-1246 BCpqrv] [-c cipher] [-F ssh_config] [-I identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user @] host1:] file1... [[user @] host2:] file2DESCRIPTION scp copies files between hosts on a network. (scp is used to copy files between hosts on the network.) It uses ssh (1) for data transfer, and uses the same authentication and provides the same security as ssh (1 ). unlike rcp (1), scp will ask for pass-words or passphrases if they are needed for authentication. file names may contain in a user and host specification to indicate that the file is to be copied to/from that host. local file names can be made explicit using absolute or relative pathnames to avoid scp treating file names ining ':' as host speci-fiers. copies between two remote hosts are also permitted. when copying a source file to a target file which already exists, scp will replace the contents of the target file (keeping the inode ). if the target file does not yet exist, an empty file with the target file name is created, then filled with the source file contents. no attempt is made at "near-atomic" transfer using temporary files.
-P Port
-P persistence attribute
-R copy directory
4. FTP Function Service sftp
Upload:
[root@localhost tmp]# sftp -oport=22 root@192.168.181.129Connecting to 192.168.181.129...root@192.168.181.129's password: sftp> put /tmp/666 /tmpstat /tmp/666: No such file or directorysftp> put /tmp/123.txt /tmpUploading /tmp/123.txt to /tmp/123.txt/tmp/123.txt 100% 0 0.0KB/s 00:00
Check that the upload is successful!
Download:
sftp> get /tmp/666 /tmpFetching /tmp/666 to /tmp/666sftp> get /tmp/666 /optFetching /tmp/666 to /opt/666
Check that the download to the local device is successful!