#! /Bin/bash
# For security of OS
For IP in 'cat ip.txt'
Do
Echo-e "\ 033 [31 m ###################$ IP ########### ########## \ 033 [0 m"
Redhatversion = 'ssh $ IP-c "cat/etc/issue" | awk Nr = 1' {print $7 }''
If [$ {redhatversion} = '5. 6']
Then
SSH $ IP-c "chattr-I/etc/login. defs & authconfig -- passalgo = sha256 -- Update & chattr + I/etc/login. defs & authconfig -- Test | grep hashing"
Echo "[success!] $ IP passalgo has been changed into sha256 "> chpassalgo. Log
Echo-e "\ 033 [31 m [success!] $ IP passalgo has been changed into sha256 \ 033 [0 m"
Else
Echo "[soory!] $ IP redhatversion is not 5.6, it is $ redhatversion, no need tobeen changed "> chpassalgo. Log
Echo-e "\ 033 [31 m [soory!] $ IP redhatversion is not 5.6, it is $ redhatversion, no need to been changed \ 033 [0 m"
Fi
Done
This document is completed very late. Despite the great intensity of work every day, I am willing to make progress with you. HahaMake progress every day.
We will introduce other modules in the future. If you have any questions, please do not point them out and make improvements together. You are welcome to join us with our technical enthusiasts.QqGroup262407268To build our cloud-Connected Smart City
This article is from the "davideylee" blog, please be sure to keep this source http://davideylee.blog.51cto.com/8703117/1439225