Linux-remote change password (more)

1.creat managment Certification on Mangar Server
ssh-keygen -t rsa
2.creat client Certification on Client
ssh-keygen -t rsa
3.Copy certification from Server to Client and change name "authorized_keys"

scp /root/.ssh/id_rsa.pub 192.168.1.XX1:/root/.ssh/authorized_keys
scp /root/.ssh/id_rsa.pub 192.168.1.XX2:/root/.ssh/authorized_keys

Mark:  pls backup the Public RSA key to other server

4.install password creater " expect "
yum -y install expect expect-devel

+++++++++++++++mkpasswd++++++++++++++++++++++++++++
mkpasswd [args] [user]
where arguments are:
-l # (length of password, default = 10)
-d # (min # of digits, default = 2)
-c # (min # of lowercase chars, default = 2)
-C # (min # of uppercase chars, default = 2)
-s # (min # of special chars, default = 1)
-v (verbose, show passwd interaction)
-p prog (program to set password, default = passwd)
+++++++++++++++mkpasswd++++++++++++++++++++++++++++

5.vi /root/.ssh/ip_list.txt
192.168.1.XX1
192.168.1.XX2
192.168.1.XX3
...

6.vi /root/.ssh/Changepassword.sh

+++++++++++++++Changepassword.sh++++++++++++++++++++++++++++
#!/bin/bash
for IP in `cat /root/.ssh/ip_list.txt` #input client IP address
do
TMP_PWD=`mkpasswd -l 10 -C 3 -c 2 -d 2`
R_PWD=`echo ${TMP_PWD}`
echo "${TMP_PWD}" > .R_PWD.txt
if [ $? = 0 ] ; then
ssh $IP passwd root --stdin < .R_PWD.txt
echo -e "$(date "+%Y-%m-%d %H:%M:%S")\t${IP}\t${R_PWD}\t" >> R_Server.log
else
echo -e "$(date "+%Y-%m-%d %H:%M:%S")\t${IP} R_PWD.txt is create fail\tplease check!\t"
fi
if [ $? = 0 ] ; then
echo -e "$(date "+%Y-%m-%d %H:%M:%S")\tThe ${IP} passwd is modify OK\t"
else
echo -e "$(date "+%Y-%m-%d %H:%M:%S")\tThe ${IP} passwd is modify fail\tplease check!\t"
fi
done
echo "+++++++++++++IP and Password List+++++++++++++++++"
cat R_Server.log
rm .R_PWD.txt -f
+++++++++++++++Changepassword.sh++++++++++++++++++++++++++++

7.modify the X right

cd /root/.ssh/
chmod 777 changepassword.sh

8.run it
./changepassword.sh

时间: 2024-10-20 17:08:32

Linux-remote change password (more)的相关文章

HowTo: Linux Server Change OR Setup The Timezone

My Linux systems timezone is pointing to the wrong timezone. How do I setup or change the timezone under Linux operating systems? Unix time, or POSIX time, is a system for describing points in time: it is the number of seconds elapsed since midnight

How to Change Password Complexity Requirements in Windows XP

Original Link: http://www.ehow.com/how_4812793_password-complexity-requirements-windows-xp.html#ixzz32PEZAbOn When you create a new account in Windows XP, you choose a username and a password, which must be a certain length. If you want to get rid of

linux的/etc/password&amp;&amp;/etc/shadow的学习记录

/etc/passwd root?0:0:root:/root:/bin/bashdaemon?1:1:daemon:/usr/sbin:/bin/shbin?2:2:bin:/bin:/bin/shsys?3:3:sys:/dev:/bin/sh root: x : 0 : 0 : root : /root : /bin/bash名字 :密码 :用户id :组id :用户信息 :主目录 :shell 一些缺省账号,可以用来迷糊管理员: adm拥有账号文件,起始目录/var/adm通常包括日志文

Linux REMOTE HOST IDENTIFICATION HAS CHANGED错误解决方法

http://linuxme.blog.51cto.com/1850814/375752       WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED解决方法 这几天都这整linux集群,在做测试 Marking Packets with iptables 时遇到一个问题,想通过博客的形式记录此错误具体如下:  当ssh 10.1.1.61  时出现一下情况: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Linux --remote (ssh and VNC)

远程管理 与个人计算机不同,服务器一般都是运行IDC机房中,所以我们通常不会接触到服务器硬件,而是通过各种远程管理方式对服务器进行控制. 常见的远程管理工具方式: -RDP(remote desktop protocol)协议,Windows远程桌面管理: -telnet CLI界面下的远程管理,几乎所有操作系统都有(内容是明文传输,安全性很弱): -SSH (secure shell)CLI界面下的远程管理,几乎是所有操作系统都有(内容加密传输),类Unix系统下主要的远程管理方式(linux

Hacked VisualSVN Server by PHP to allow user change password

index.php <?php$username = $_SERVER["PHP_AUTH_USER"]; //经过 AuthType Basic 认证的用户名$authed_pass = $_SERVER["PHP_AUTH_PW"]; //经过 AuthType Basic 认证的密码$input_oldpass = (isset($_REQUEST["oldpass"]) ? $_REQUEST["oldpass"

Linux hang when password encryption

When using encryption (cfglib @Secured items, dblib-disk disk encryption), the application uses SecureRandom to get random data (for key generation, etc.). In case of a virtual machine and Linux, the system entropy can be low which may result in extr

Linux Lab and project latest

samba : start your samba service netlogon syslog vi /usr/local/samba vi /usr/samba/etc/smb.conf smbclient //localhost/netlogon -UAdministrator%"Supinfo -c "ls: ls -al vi /etc/resolv.conf add these info in the file domain nbouaziz.net search nbou

[转] 关于linux下通过shell命令(自动)修改用户密码

关于linux下通过shell命令(自动)修改用户密码 2012-04-23 18:47:39 分类: 原文地址:关于linux下(自动)修改用户密码 作者:ubuntuer 本文章总结了如何手动.自动修改本地用户密码及远程机器的用户密码.对做自动化测试提供了自动修改用户密码的原理及方法. 修改本地用户密码:1.交互配置本地用户:以root用户: passwd <username>Changing password for user dewang.New UNIX password: BAD