SSH usage and summary

Source: Internet
Author: User
SSH usage and summary SSH service (TCP port 22): secure command interpreter provides a secure Shell environment for clients to remotely manage SSH based on public key encryption (asymmetric encryption) technology: encrypted data transmission; client and server authentication; public and private keys... information & n SSH usage and summary SSH service (TCP port 22): a secure command interpreter provides a secure Shell environment for the client, used for remote management SSH based on public key encryption (asymmetric encryption) Technology: data encryption transmission; client and server authentication; public key and private key are generated in pairs, these two keys are different, the two keys can be encrypted and decrypted to each other. one key cannot be used to calculate another key. The public key is made public to the outside, and the private key can only be known to the owner of the private key; www.2cto.com data encryption and digital signature (based on different functions) the sender uses the recipient's public key to encrypt data; the receiver uses its own private key to decrypt data; data encryption ensures the confidentiality of the sent data. digital signatures: (digital signatures ensure data integrity, identity verification, and inaccessibility) Sender: executes the HASH algorithm on the original data to obtain the digest value. the sender uses its own private key to encrypt the digest value. the sender sends the encrypted digest value and the original data to the receiver. receiver: decrypt the digest value with the sender's public key, and generate another Digest value for the received raw data. compare the decrypted digest value with the generated digest value. www.2cto.com OpenSSH: server Main program:/usr/sbin/sshd client main program:/usr/bin/ssh server configuration file:/etc/ssh/sshd_config (restart shhd service to take effect) client configuration file: /etc/ssh/ssh_configSSH user name used for logon: account name of the local system user in the server; password verification for SSH logon: use the password of the system account in the server; (PasswordAuthentcation yes) key pair verification: use the public key and private key generated in the client; (PubkeyAuthentication yes AuthorizedKey File. ssh/authorized_keys) remote logon using the ssh command: 1.ssh username @ server address 2.ssh-l username server address (rarely used) 3.ssh server address (which user is used by the server to log on to?) Other common commands related to SSH: passwd # modify the current user password groupadd SSH # Add group useradd-g SSH-s/bin/'Bash'-d/home/user1 user1 # Add user passwd user1 # create for user user1 password userdel user1 # delete user1groupdel SSH # delete a group SSH disabled account, VIM edit the password file and add ": *" after the user name ":*". Www.2cto.com vim/etc/shadow12service sshd restart # restart sshdps-aux | grep sshd # check whether the client key is successfully stored ~. The key storage location of the server in the ssh directory/etc/ssh/ssh_host _ * known_hosts stores the public key authorized_keys of the Accessed server and stores the public key of the client to be verified. the reason why the ssh folder and the group with the following file permissions and other people cannot have the w permission for ssh access is slow and the solution is: when accessing the server, the IP address of the server is reversed to the domain name, if the resolution fails, the login will be slow. the following three methods can solve this problem: 1. clear/etc/resolv. the nameserver record in the conf file 2. add the server domain name resolution record in the/etc/hosts file of the client 3. modify the/etc/ssh/ssh_config file of the client: GSSAPIAuthentication no Problem 2: If the public key file is faulty, authentication will fail. the solution is to delete the file rm-rf/root /. ssh/know_hosts service sshd restart configuration case: www.2cto.com password mode: service sshd restart service netstat-anpt | grep sshd view port login host: ssh root@192.168.100.127 ssh directly on the remote host new user: ssh root@10.10.10.1 adduser txy in password authentication should look at: server side/etc/ssh/sshd_config PasswordAuthentcation yes ,, password authentication for the first access to the server without entering yes ssh-o StrictHostKeyChecking = no root@10.10.10.1/etc/ssh/ssh_config client file StrictHostKeyChecking no first access to the server without entering the yes key method www.2cto.com here in this example, a common user logs on to the server, it is easier for the root user to log on. there is no need to create a file or modify the permissions. the root user who copies the scp under the place where the key is generated is also under root: the server can view the file: modify PubkeyAuthentication in/etc/ssh/sshd_config to create the file mkdir/home/xiaohua /. ssh file modification permission: chomd-R 600/home/xiaohu /. other users of ssh in this file cannot have the w permission client: useradd xiaolue su-xiaolue ssh-keygen scp/home/xiaolue /. ssh/id_rsa.pub root@192.168.100.127:/home/xiaohua /. ssh/authorized_keys access control:/etc/hosts. allow takes precedence over/etc/hosts below. deny first checks hosts. allow file. if a matched policy is found, access is allowed; otherwise, check the hosts. deny file. if a matching policy is found, access is denied. If no matching policy exists in both files, access is allowed; www.2cto.com vim/etc/hosts. allow sshd: 210.13.218. *: the ip address that allow allows to log on to. allow can omit the ip address that can control the service range: 1. it is managed by the super daemon (xinetd) service. 2. libwrap is supported. check whether the service of the so module controls the specific service: ldd/usr/sbin/sshd | grep wrap idd $ (which service) | restart the service after grep wrap is modified: service xined restart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.