CentOS 6.7 Combat Deployment Sshkey

Source: Internet
Author: User

Deployment environment:

Prepare two (or more)CentOS 6.7 x86_64 servers

Where the IP address is 10.0.0.7 for the Sshkey distribution machine

1. Create user Wanyuetian for each server and create password 123456

[Email protected] ~]# useradd Wanyuetian [[email protected] ~]# echo 123456|passwd--stdin wanyuetianchanging password fo R User Wanyuetian.passwd:all authentication tokens updated successfully.

2. Create a key pair in the distribution machine (10.0.0.7)

[[email protected] scripts]# su-wanyuetian[[email protected] ~]$ ssh-keygen-t DSA #一路回车 [[email protected] ~]$ ls-l  . ssh/total 8-rw-------1 wanyuetian wanyuetian 672 Oct 16:07 id_dsa-rw-r--r--1 Wanyuetian Wanyuetian 608 Oct 22 16:07 Id_dsa.pub

3. Distribute the public key (in 10.0.0.8, for example, the other is the same), SSH port is 22

[Email protected] ~]$ ssh-copy-id-i ssh/id_dsa.pub [email protected]

If the SSH port is not 22, use the command ssh-copy-id-i. Ssh/id_dsa.pub "-P 52113 [email protected]"

[Email protected] ~]# ll/home/wanyuetian/.ssh/-rw-------1 Wanyuetian Wanyuetian 608 Oct 16:11 Authorized_keys


After the id_dsa.pub is distributed, the other client's name becomes Authorized_keys and the content has not changed, so you can package the distribution or put it on the Web server for download after renaming the server, note authorized_ The keys file must have permissions of 600
4. Test Remote Execution command

[[email protected] ~]$ ssh -p22 [email protected] /sbin/ifconfig  eth0eth0      link encap:ethernet  hwaddr 00:0c:29:f6:a2:78             inet addr:10.0.0.8   bcast:10.0.0.255  mask:255.255.255.0           inet6 addr: fe80::20c:29ff:fef6:a278/64 scope:link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:41966 errors:0 dropped:0  overruns:0 frame:0          tx packets:24455  errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           rx bytes:5163110  (4.9  MIB)   TX bytes:3706021  (3.5 MIB)

Ps: To this, Sshkey deployment is completed, this case I was made with ordinary users, so security is high, but for batch management and distribution of files is more inconvenient, requires root to do sudo authorization. If you do not consider security, you can deploy directly with the root user.

Sshkey is suitable for small-scale cluster environment deployment and management (that is, only about dozens of servers), if the server is more, you can consider using Saltstack for batch management.

This article is from the "architects of the Day" blog, be sure to keep this source http://wanyuetian.blog.51cto.com/3984643/1717055

CentOS 6.7 Combat Deployment Sshkey

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.