scripts tp crsamba
This commit is contained in:
		
							
								
								
									
										6
									
								
								sio1/sisr1/18-bash/tpbash/crsamba
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								sio1/sisr1/18-bash/tpbash/crsamba
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| #!/bin/bash | ||||
| fich=users.txt | ||||
| while read ligne | ||||
| do | ||||
| 	echo $ligne | ||||
| done < $fich | ||||
							
								
								
									
										22
									
								
								sio1/sisr1/18-bash/tpbash/crsamba3
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								sio1/sisr1/18-bash/tpbash/crsamba3
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
|  | ||||
| usage() { | ||||
| 	echo "usage : $0 <users.txt>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| if [[ $# != 1 ]] ; then | ||||
| 	usage | ||||
| fi | ||||
|  | ||||
| fich=$1 | ||||
| if [[ ! -r $fich ]] ; then | ||||
| 	echo "i$0: erreur ouverture fichier $fich" | ||||
| 	exit 2 | ||||
| fi | ||||
| while read ligne | ||||
| do | ||||
| 	echo $ligne | ||||
| done < $fich | ||||
|  | ||||
							
								
								
									
										25
									
								
								sio1/sisr1/18-bash/tpbash/crsamba4
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								sio1/sisr1/18-bash/tpbash/crsamba4
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
|  | ||||
| usage() { | ||||
| 	echo "usage : $0 <users.txt>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| if [[ $# != 1 ]] ; then | ||||
| 	usage | ||||
| fi | ||||
|  | ||||
| fich=$1 | ||||
| if [[ ! -r $fich ]] ; then | ||||
| 	echo "i$0: erreur ouverture fichier $fich" | ||||
| 	exit 2 | ||||
| fi | ||||
| while read ligne | ||||
| do | ||||
| 	login=$(echo "${ligne}"|cut -f1 -d:) | ||||
|         echo $login	 | ||||
| 	nom=$(echo "${ligne}"|cut -f2  -d:) | ||||
| 	echo $nom | ||||
| done < $fich | ||||
|  | ||||
							
								
								
									
										34
									
								
								sio1/sisr1/18-bash/tpbash/crsamba5
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								sio1/sisr1/18-bash/tpbash/crsamba5
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
|  | ||||
| usage() { | ||||
| 	echo "usage : $0 <users.txt>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| if [[ $# != 1 ]] ; then | ||||
| 	usage | ||||
| fi | ||||
|  | ||||
| fich=$1 | ||||
| if [[ ! -r $fich ]] ; then | ||||
| 	echo "i$0: erreur ouverture fichier $fich" | ||||
| 	exit 2 | ||||
| fi | ||||
| while read ligne | ||||
| do | ||||
| 	login=$(echo "${ligne}"|cut -f1 -d:) | ||||
|         #echo $login	 | ||||
| 	nom=$(echo "${ligne}"|cut -f2  -d:) | ||||
| 	#echo $nom | ||||
| 	if ! getent passwd "${nom}" > /dev/null 2 >&1 | ||||
| 	then | ||||
| 		sudo useradd -m -c "${nom}" -s /bin/bash "${login}" | ||||
| 		mdp=$(pwgen 6 1)  | ||||
| 		echo "${login}:${mdp}"|sudo chpasswd | ||||
| 		echo "${login}:${mdp}">>${fich}.pw | ||||
|  | ||||
| 	else | ||||
| 		echo "${nom}" existe déja	 | ||||
| 	fi | ||||
| done < $fich  | ||||
							
								
								
									
										29
									
								
								sio1/sisr1/18-bash/tpbash/crsamba6
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								sio1/sisr1/18-bash/tpbash/crsamba6
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
|  | ||||
| usage() { | ||||
| 	echo "usage : $0 <users.txt>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| if [[ $# != 1 ]] ; then | ||||
| 	usage | ||||
| fi | ||||
|  | ||||
| fich=$1 | ||||
| if [[ ! -r $fich ]] ; then | ||||
| 	echo "i$0: erreur ouverture fichier $fich" | ||||
| 	exit 2 | ||||
| fi | ||||
| while read ligne | ||||
| do | ||||
| 	login=$(echo "${ligne}"|cut -f1 -d:) | ||||
|         #echo $login	 | ||||
| 	nom=$(echo "${ligne}"|cut -f2  -d:) | ||||
| 	#echo $nom | ||||
| 	if  getent passwd "${login}" > /dev/null 2 >&1 | ||||
| 	then | ||||
| 		sudo userdel -r -f  "${login}" | ||||
| 	fi | ||||
| 	#echo $ligne | ||||
| done < $fich  | ||||
							
								
								
									
										29
									
								
								sio1/sisr1/18-bash/tpbash/crsamba7
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								sio1/sisr1/18-bash/tpbash/crsamba7
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
|  | ||||
| usage() { | ||||
| 	echo "usage : $0 <users.txt>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| if [[ $# != 1 ]] ; then | ||||
| 	usage | ||||
| fi | ||||
|  | ||||
| fich=$1 | ||||
| if [[ ! -r $fich ]] ; then | ||||
| 	echo "i$0: erreur ouverture fichier $fich" | ||||
| 	exit 2 | ||||
| fi | ||||
| while read ligne | ||||
| do | ||||
| 	login=$(echo "${ligne}"|cut -f1 -d:) | ||||
|         #echo $login	 | ||||
| 	nom=$(echo "${ligne}"|cut -f2  -d:) | ||||
| 	#echo $nom | ||||
| 	if  getent passwd "${login}" > /dev/null 2 >&1 | ||||
| 	then | ||||
| 		sudo userdel -r -f  "${login}" | ||||
| 	fi | ||||
| 	#echo $ligne | ||||
| done < $fich  | ||||
							
								
								
									
										34
									
								
								sio1/sisr1/18-bash/tpbash/sio@192.168.0.100
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								sio1/sisr1/18-bash/tpbash/sio@192.168.0.100
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
|  | ||||
| usage() { | ||||
| 	echo "usage : $0 <users.txt>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| if [[ $# != 1 ]] ; then | ||||
| 	usage | ||||
| fi | ||||
|  | ||||
| fich=$1 | ||||
| if [[ ! -r $fich ]] ; then | ||||
| 	echo "i$0: erreur ouverture fichier $fich" | ||||
| 	exit 2 | ||||
| fi | ||||
| while read ligne | ||||
| do | ||||
| 	login=$(echo "${ligne}"|cut -f1 -d:) | ||||
|         #echo $login	 | ||||
| 	nom=$(echo "${ligne}"|cut -f2  -d:) | ||||
| 	#echo $nom | ||||
| 	if ! getent passwd "${nom}" > /dev/null 2 >&1 | ||||
| 	then | ||||
| 		sudo useradd -m -c "${nom}" -s /bin/bash "${login}" | ||||
| 		mdp=$(pwgen 6 1)  | ||||
| 		echo "${login}:${mdp}"|sudo chpasswd | ||||
| 		echo "${login}:${mdp}">>${fich}.pw | ||||
|  | ||||
| 	else | ||||
| 		echo "${nom}" existe déja	 | ||||
| 	fi | ||||
| done < $fich  | ||||
							
								
								
									
										4
									
								
								sio1/sisr1/18-bash/tpbash/users.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								sio1/sisr1/18-bash/tpbash/users.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| laymar:Lucien Aymar | ||||
| cperier:Claudine Perier | ||||
| rdubois:Robert Dubois | ||||
| mlefebvre:Marcelle Lefebvre | ||||
							
								
								
									
										12
									
								
								sio1/sisr1/18-bash/tpbash/users.txt.pw
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								sio1/sisr1/18-bash/tpbash/users.txt.pw
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| laymar:uomeM8 | ||||
| cperier:za2Iez | ||||
| rdubois:an6ahJ | ||||
| mlefebvre:Aque8E | ||||
| laymar:Eimai2 | ||||
| cperier:Iesoo9 | ||||
| rdubois:loo6Ac | ||||
| mlefebvre:guCh0s | ||||
| laymar:reY9ze | ||||
| cperier:eR7iel | ||||
| rdubois:Bee7Ee | ||||
| mlefebvre:Ook3fe | ||||
		Reference in New Issue
	
	Block a user