The SSH usage of CentOS

Source: Internet
Author: User
Tags ssh server

Basic use of SSH for Linux.

Often log on to a server, do not want to enter the user name and password every time, how to do?

1. Public and private key law, password-free login.

In fact, secret key public key method, than with the user name and password to be more secure, basically can not brute force, of course, if the private key is stolen play.

Generate a pair of public and secret keys on the Linux machine on your own side first.

SSH-KEYGEN-T RSA

3 consecutive returns will generate a pair of keys in the user's. SSH directory Id_rsa and Id_rsa.pub,id_rsa.pub is of course the public key.

The following is to get the public key that was just generated to the server to log on.

Where should this file be located on the server, go to the user directory, and use Ls-al to see a. SSH directory, if not just one time on the server SSH will be generated, into. SSH, do a file called Authorized_keys, Copy the file contents of the public key to this file, and of course there is a handy command to complete. Executed on the client side of the machine

Ssh-copy-id-i ~/.ssh/id_rsa.pub [email protected] Server IP

Here root is to be transferred to the server user, this automatic login is for the user, the general default is to use this user name.

For example, if the client is logged in with Root,

SSH server IP

So is the login server root account, if you want to login to other accounts before the IP address plus user name @, [email protected]

In addition, depending on the version of the machine, this key login is not necessarily possible.

Need to edit pubkeyauthentication Yes in/etc/ssh/sshd_config file


2. Port forwarding


This article from "Genius without that 1% is absolutely impossible" blog, please be sure to keep this source http://xushen.blog.51cto.com/1673219/1672506

The SSH usage of CentOS

Related Article

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.