你的位置:首页 > 软件开发 > 操作系统 > SSH批量部署服务

SSH批量部署服务

发布时间:2016-03-06 23:00:27
SSH批量部署服务1.1在NFS上作为中心分发服务器将私钥分发到其他服务器上1.1.1NFS部署 1 [root@nfs-server ~]# useradd zhurui 2 [root@nfs-server ~]# echo 123456|passwd --stdin ...

SSH批量部署服务

1.1在NFS上作为中心分发服务器将私钥分发到其他服务器上

1.1.1NFS部署

 

 1 [root@nfs-server ~]# useradd zhurui 2 [root@nfs-server ~]# echo 123456|passwd --stdin zhurui 3 Changing password for user zhurui. 4 passwd: all authentication tokens updated successfully. 5 创建密码对: 6 [root@nfs-server ~]# su - zhurui   ##切换到zhurui用户下,以后批量分发都在当前用户下,安全考虑 7 [zhurui@nfs-server ~]$ ssh-keygen -t dsa ##ssh-keygen是生成秘钥的工具,-t参数指建立秘钥的类型,这里建立dsa类型秘钥(还有一种类型的秘钥为RSA,两者加密算法有区别) 8 Generating public/private dsa key pair. 9 Enter file in which to save the key (/home/zhurui/.ssh/id_dsa): 10 Created directory '/home/zhurui/.ssh'.11 Enter passphrase (empty for no passphrase): 12 Enter same passphrase again: 13 Your identification has been saved in /home/zhurui/.ssh/id_dsa.14 Your public key has been saved in /home/zhurui/.ssh/id_dsa.pub.15 The key fingerprint is:16 6f:65:c4:a6:fb:32:45:0c:85:c3:bc:87:8f:a4:ae:bc zhurui@nfs-server17 The key's randomart image is:18 +--[ DSA 1024]----+19 |     o o.  |20 |     *.   |21 |      *+  |22 |     +++  |23 |    So.=o  |24 |    ...+o  |25 |    . +.   |26 |   . ..o.   |27 |   Eo  o.  |28 +-----------------+29 [zhurui@nfs-server ~]$ 30 [zhurui@nfs-server ~]$ ls -l .ssh/31 total 832 -rw-------. 1 zhurui zhurui 672 Mar 5 04:23 id_dsa  ##私钥33 -rw-r--r--. 1 zhurui zhurui 607 Mar 5 04:23 id_dsa.pub ##公钥34 将公钥分发给web-lamp01服务器35 [zhurui@nfs-server ~]$ ssh-copy-id -i .ssh/id_dsa.pub zhurui@192.168.1.12 ##将公钥分发给1.12服务器36 The authenticity of host '192.168.1.12 (192.168.1.12)' can't be established.37 RSA key fingerprint is d6:e6:e6:2a:c7:df:99:51:bb:f4:90:29:16:df:c4:a5.38 Are you sure you want to continue connecting (yes/no)? yes39 Warning: Permanently added '192.168.1.12' (RSA) to the list of known hosts.40 Nasty PTR record "192.168.1.12" is set up for 192.168.1.12, ignoring41 zhurui@192.168.1.12's password: 42 Permission denied, please try again.43 zhurui@192.168.1.12's password: 44 Now try logging into the machine, with "ssh 'zhurui@192.168.1.12'", and check in:45 46  .ssh/authorized_keys47 48 to make sure we haven't added extra keys that you weren't expecting.49 50 [zhurui@nfs-server ~]$ 

原标题:SSH批量部署服务

关键词:SSH

SSH
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。