How CentOS connects to a host remotely using SSH

Source: Internet
Author: User

SSH has two ways of connecting

The first type: Password Authentication connection mode

[[email  Protected] ~]# ssh [email protected]   (the IP return prompt for the server is as follows)
The authenticity of the host ' 192.168.1.250 (192.168.1.250) ' can ' t be established.
RSA key fingerprint is 75:f9:55:3b:da:0d:38:b2:c6:1b:e9:18:96:97:8a:2e.
is you sure want to continue connecting ( yes/no)? (enter Yes to guarantee key return)

warning:permanently added ' 192.168.1.250 ' (RSA) to the list of known hosts.
[email protected]' s password: (input password Enter)

The second type: Key connection mode

[[email protected] ~]# Ssh-keygen (startup key connection mode)
Generating public/private RSA key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): ( the place where the key is kept is guaranteed by default

exists in the current user directory as required

Modify, enter hold address)
Enter passphrase (empty for no passphrase):(Use default return if password is used)
Enter same Passphrase again:
Your identification has been saved In/root/.ssh/id_rsa.
Your public key has been saved in/root/.ssh/id_rsa.pub.
The key fingerprint is:
E4:4d:4c:b7:e4:ec:07:d5:a7:f0:3c:a0:b0:1f:98:a1[email protected]
The key ' s Randomart image is:
+--[RSA 2048]----+
| . O.. |
| OO =oo o|
| .. *o.==. |
| Eo+oo. .=  |
| S ... |
|  .   . |
| |
| |
| |
+-----------------+

After the key is generated, enter the. ssh/directory to see

[[Email protected] ~]# CD. ssh/
[email protected]. ssh]# ls
Id_rsa id_rsa.pub known_hosts (id_rsa.pub) This file is the key authentication file

[email protected]. ssh]# ssh-copy-id-i id_rsa.pub [email protected] (sends the key to the server)
[email protected]' s Password: (Enter the service-side password) Enter the prompt as follows to succeed

Now try logging to the machine, with "SSH '[email protected]' ", and check in:

. Ssh/authorized_keys

To make sure we haven ' t added extra keys so you weren ' t expecting.

Note: If the system is installed or if other conditions are not properly connected, remove the files from the. ssh/directory and reconfigure them.

If you want to compare security or control user login into cd/etc/ssh will see

[email protected]. ssh]# cd/etc/ssh
[[email protected] ssh]# ls
Moduli Ssh_host_dsa_key ssh_host_key.pub
Ssh_config ssh_host_dsa_key.pub Ssh_host_rsa_key
Sshd_config Ssh_host_key ssh_host_rsa_key.pub

Ssh_config This is the client configuration file, Sshd_config This is the server configuration file to modify this.

Open Ssh_config with Vim

Syslogfacility Authpriv
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin Yes (change this to No to disable root login)
#StrictModes Yes
#MaxAuthTries 6
#MaxSessions 10


# To disable tunneled clear text passwords, change to No here!
#PasswordAuthentication Yes
#PermitEmptyPasswords No
Passwordauthentication Yes (change this to No to use password Authentication)

How CentOS connects to a host remotely using SSH

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.