script
This commit is contained in:
		
							
								
								
									
										10
									
								
								sio2/sisr/script/bash/script/crsamba1
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								sio2/sisr/script/bash/script/crsamba1
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
fich='user.txt'
 | 
			
		||||
while read ligne
 | 
			
		||||
do
 | 
			
		||||
  echo  "${ligne}"
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								sio2/sisr/script/bash/script/crsamba2
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								sio2/sisr/script/bash/script/crsamba2
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
if [[ $# != 1 ]]; then
 | 
			
		||||
	echo "usage : $0 <fichier>"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
fich="$1"
 | 
			
		||||
while read ligne
 | 
			
		||||
do
 | 
			
		||||
  echo  "${ligne}"
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								sio2/sisr/script/bash/script/crsamba3
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								sio2/sisr/script/bash/script/crsamba3
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
if [[ $# != 1 ]]; then
 | 
			
		||||
	echo "usage : $0 <fichier>"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
fich="$1"
 | 
			
		||||
if ! [[ -r "${fich}" ]]; then
 | 
			
		||||
	echo "$0 : erreur ouverture fichier ${fich}"
 | 
			
		||||
        exit 2
 | 
			
		||||
fi
 | 
			
		||||
while read ligne
 | 
			
		||||
do
 | 
			
		||||
  echo  "${ligne}"
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										22
									
								
								sio2/sisr/script/bash/script/crsamba4
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								sio2/sisr/script/bash/script/crsamba4
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
if [[ $# != 1 ]]; then
 | 
			
		||||
	echo "usage : $0 <fichier>"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
fich="$1"
 | 
			
		||||
if ! [[ -r "${fich}" ]]; then
 | 
			
		||||
	echo "$0 : erreur ouverture fichier ${fich}"
 | 
			
		||||
        exit 2
 | 
			
		||||
fi
 | 
			
		||||
while read ligne
 | 
			
		||||
do
 | 
			
		||||
	login=$(echo  "${ligne}" |cut -f1 -d':')
 | 
			
		||||
	nom=$(echo  "${ligne}" |cut -f2 -d':')
 | 
			
		||||
	echo "$login"
 | 
			
		||||
	echo "$nom"
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								sio2/sisr/script/bash/script/crsamba5
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								sio2/sisr/script/bash/script/crsamba5
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
if [[ $# != 1 ]]; then
 | 
			
		||||
	echo "usage : $0 <fichier>"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
fich="$1"
 | 
			
		||||
if ! [[ -r "${fich}" ]]; then
 | 
			
		||||
	echo "$0 : erreur ouverture fichier ${fich}"
 | 
			
		||||
        exit 2
 | 
			
		||||
fi
 | 
			
		||||
while read ligne
 | 
			
		||||
do
 | 
			
		||||
	login=$(echo  "${ligne}" |cut -f1 -d':')
 | 
			
		||||
	nom=$(echo  "${ligne}" |cut -f2 -d':')
 | 
			
		||||
        getent passwd "${login}" >> /dev/null	
 | 
			
		||||
        if [[ $? != 0 ]] ; then	 
 | 
			
		||||
	  useradd -m -d /home/${login} -c "${nom}" -s /bin/bash ${login}
 | 
			
		||||
          	  
 | 
			
		||||
        else 
 | 
			
		||||
	  echo "utilisateur ${login} existant"
 | 
			
		||||
	fi
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										31
									
								
								sio2/sisr/script/bash/script/crsamba7
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								sio2/sisr/script/bash/script/crsamba7
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
PATH=${PATH}:/usr/sbin
 | 
			
		||||
if [[ $# != 1 ]]; then
 | 
			
		||||
	echo "usage : $0 <fichier>"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
fich="$1"
 | 
			
		||||
if ! [[ -r "${fich}" ]]; then
 | 
			
		||||
	echo "$0 : erreur ouverture fichier ${fich}"
 | 
			
		||||
        exit 2
 | 
			
		||||
fi
 | 
			
		||||
while read ligne
 | 
			
		||||
do
 | 
			
		||||
	login=$(echo  "${ligne}" |cut -f1 -d':')
 | 
			
		||||
	nom=$(echo "${ligne}" |cut -f2 -d':')
 | 
			
		||||
        getent passwd "${login}" >> /dev/null
 | 
			
		||||
        if [[ $? != 0 ]] ; then
 | 
			
		||||
	  useradd -m -d /home/${login} -c "${nom}" -s /bin/bash ${login}
 | 
			
		||||
	  pw=$(pwgen 4 1)
 | 
			
		||||
          echo "${login}:${pw}"|chpasswd
 | 
			
		||||
	  echo "${login}:${pw}" >> "${fich}.pwd"
 | 
			
		||||
	else
 | 
			
		||||
	   echo "$0 : utilisateur ${login} existant"
 | 
			
		||||
	fi 
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								sio2/sisr/script/bash/script/fichier.pwd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								sio2/sisr/script/bash/script/fichier.pwd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								sio2/sisr/script/bash/script/rmsamba
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								sio2/sisr/script/bash/script/rmsamba
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#set -o errexit
 | 
			
		||||
set -o nounset
 | 
			
		||||
if [ $# != 1 ]
 | 
			
		||||
then
 | 
			
		||||
	echo "usage : $0 <fichier>"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
fich="$1"
 | 
			
		||||
if ! [[ -r "${fich}" ]]; then
 | 
			
		||||
	echo "$0 : erreur ouverture fichier ${fich}"
 | 
			
		||||
        exit 2
 | 
			
		||||
fi
 | 
			
		||||
while read -r ligne
 | 
			
		||||
do
 | 
			
		||||
	login=$(echo  "${ligne}" |cut -f1 -d':')
 | 
			
		||||
 | 
			
		||||
	echo "${login}"
 | 
			
		||||
        getent passwd "${login}" >> /dev/null	
 | 
			
		||||
        if [[ $? = 0 ]]	
 | 
			
		||||
	then	 
 | 
			
		||||
 	  userdel -r "${login}"
 | 
			
		||||
	fi
 | 
			
		||||
done < "${fich}"
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								sio2/sisr/script/bash/script/user.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								sio2/sisr/script/bash/script/user.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
lucien
 | 
			
		||||
claudine
 | 
			
		||||
robert
 | 
			
		||||
marcelle
 | 
			
		||||
							
								
								
									
										4
									
								
								sio2/sisr/script/bash/script/user2.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								sio2/sisr/script/bash/script/user2.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
lucien:Lucien Dubois
 | 
			
		||||
claudine:Claudine Duparc
 | 
			
		||||
robert:Robert Macaire
 | 
			
		||||
marcelle:Marcelle Desforets
 | 
			
		||||
							
								
								
									
										26
									
								
								sio2/sisr/script/bash/script/user2.txt.pwd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								sio2/sisr/script/bash/script/user2.txt.pwd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
:
 | 
			
		||||
lucien:1XfC
 | 
			
		||||
claudine:PT2M
 | 
			
		||||
robert:K4PJ
 | 
			
		||||
marcelle:i4WH
 | 
			
		||||
claudine:7Giq
 | 
			
		||||
robert:VO4u
 | 
			
		||||
marcelle:3b8S
 | 
			
		||||
claudine:7qzL
 | 
			
		||||
robert:NvV6
 | 
			
		||||
marcelle:7QnY
 | 
			
		||||
lucien:e5Hz
 | 
			
		||||
claudine:j9Un
 | 
			
		||||
robert:ZnJ6
 | 
			
		||||
marcelle:B7nR
 | 
			
		||||
		Reference in New Issue
	
	Block a user