Supprimer 'CPBASH/cpbash.txt'

This commit is contained in:
2023-01-11 23:20:38 +01:00
parent 8a3cdba4e0
commit 2aab33f499

View File

@@ -1,100 +0,0 @@
Script démarré sur 2022-03-29 15:34:57+02:00 [TERM="linux" TTY="/dev/tty1" COLUMNS="100" LINES="37"]
[?2004hroot@bash:~/tpbash# ls
[?2004l
cpbash.txt crsamba3.sh crsamba5.sh rmsamba7.sh rmsamba8.sh.save.1 users.txt
crsamba2.sh crsamba4.sh present.sh rmsamba8.sh.save rmsamba.sh users.txt.pwd
[?2004hroot@bash:~/tpbash# nano users.txt
[?2004l
[?2004h)0[?7h[?25l[?1c[ Lecture... ][ Lecture de 4 lignes ] GNU nano 5.4 users.txt 
^G Aide^O Écrire ^W Chercher ^K Couper ^T Exécuter ^C EmplacementM-U Annuler
^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^J Justifier ^_ Aller ligneM-E Refaire
lucien:lucien hmar
Jean:Jean Troublette
Valentin:Valentin siboulette
Rayan:Rayan issien
[?25h[?0c[?25l[?1c[?25h[?0c
[?2004l[?2004hroot@bash:~/tpbash# nano users.txtcrsamba8
[?2004l
[?2004h)0[?7h[?25l[?1c[ Nouveau fichier ] GNU nano 5.4 crsamba8 
^G Aide^O Écrire ^W Chercher ^K Couper ^T Exécuter ^C EmplacementM-U Annuler
^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^J Justifier ^_ Aller ligneM-E Refaire
[?25h[?0c[?25l[?1c[?25h[?0c
[?2004l[?2004hroot@bash:~/tpbash# nano crsamba8
crsamba2.sh crsamba3.sh crsamba4.sh crsamba5.sh
root@bash:~/tpbash# nano crsamba5.sh
[?2004l
[?2004h)0[?7h[?25l[?1c[ Lecture... ][ Lecture de 26 lignes ] GNU nano 5.4 crsamba5.sh 
^G Aide^O Écrire ^W Chercher ^K Couper ^T Exécuter ^C EmplacementM-U Annuler
^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^J Justifier ^_ Aller ligneM-E Refaire
#!/bin/bash
#set -e
set -u
if [[ $# -ne 1 ]] ; thenecho "usage : $0 <fichier>"exit 1
fi
if [[ ! -r $1 ]] ; thenecho "$0 : erreur ouverture fichier $1"exit 2
fi
fich=$1
while read ligne
dologin=$(echo "$ligne" | cut -d ':' -f 1)nom=$(echo "$ligne" | cut -d ':' -f 2)getent passwd user "$login" >> /dev/nullif [[ $? -ne 0 ]] ; thensudo useradd --create-home --home-dir "/home/${login}" --shell /bin/bash -c "${nom}" "${>elseecho "$0 : user ${login} existant"fi
done < "${fich}"
[?25h[?0c[?25l[?1c*
x#!/bin/bash
x[?25h[?0c[?25l[?1cSauver l'espace modifié ?  O Oui
 N Non ^C Annuler[?25h[?0c[?25l[?1c
[?25h[?0c
[?2004l[?2004hroot@bash:~/tpbash# nano crsamba5.sh rmsamba
[?2004l
[?2004h)0[?7h[?25l[?1c[ Nouveau fichier ] GNU nano 5.4 rmsamba 
^G Aide^O Écrire ^W Chercher ^K Couper ^T Exécuter ^C EmplacementM-U Annuler
^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^J Justifier ^_ Aller ligneM-E Refaire
[?25h[?0c[?25l[?1c[?25h[?0c
[?2004l[?2004hroot@bash:~/tpbash# nano rmsamba
rmsamba7.sh rmsamba8.sh.save rmsamba8.sh.save.1 rmsamba.sh
root@bash:~/tpbash# nano rmsamba8.sh.save7.sh
[?2004l
[?2004h)0[?7h[?25l[?1c[ Lecture... ][ Lecture de 29 lignes ] GNU nano 5.4 rmsamba7.sh 
^G Aide^O Écrire ^W Chercher ^K Couper ^T Exécuter ^C EmplacementM-U Annuler
^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^J Justifier ^_ Aller ligneM-E Refaire
#!/bin/bash
#set -e
set -u
if [[ $# -ne 1 ]] ; thenecho "usage : $0 <fichier>"exit 1
fi
if [[ ! -r $1 ]] ; thenecho "$0 : erreur ouverture fichier $1"exit 2
fi
fich=$1
while read ligne
dologin=$(echo "$ligne" | cut -d ':' -f 1)nom=$(echo "$ligne" | cut -d ':' -f 2)getent passwd "$login" >> /dev/nullif [[ $? -ne 0 ]] ; thensudo useradd  --create-home --home-dir "/home/${login}" --shell /bin/bash -c "${nom}" "${>mdp=$(pwgen 6 )echo "${login}:${mdp}" | chpasswdecho "${login}:${mdp}" >> "${fich}.pwd"elseecho "$0 :utilisateur ${login} existent déjà"fi
done < "${fich}"
[?25h[?0c[?25l[?1c[?25h[?0c
[?2004l[?2004hroot@bash:~/tpbash# nano rmsamba7.sh 
rmsamba7.sh rmsamba8.sh.save rmsamba8.sh.save.1 rmsamba.sh
root@bash:~/tpbash# nano rmsamba.sh
[?2004l
[?2004h)0[?7h[?25l[?1c[ Lecture... ][ Lecture de 29 lignes ] GNU nano 5.4 rmsamba.sh 
^G Aide^O Écrire ^W Chercher ^K Couper ^T Exécuter ^C EmplacementM-U Annuler
^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^J Justifier ^_ Aller ligneM-E Refaire
#!/bin/bash
#set -e
set -u
if [[ $# -ne 1 ]] ; thenecho "usage : $0 <fichier>"exit 1
fi
if [[ ! -r $1 ]] ; thenecho "$0 : erreur ouverture fichier $1"exit 2
fi
fich=$1
while read ligne
dologin=$(echo "$ligne" | cut -d ':' -f 1)nom=$(echo "$ligne" | cut -d ':' -f 2)getent passwd "$login" >> /dev/nullif [[ $? -eq 0 ]] ; thensudo userdel  --remove "${login}"elseecho "$0 : user ${login} n'est pas existant"fi
done < "${fich}"
[?25h[?0c[?25l[?1c[?25h[?0c
[?2004l[?2004hroot@bash:~/tpbash# ./rsmsamba7.sh users.txt
[?2004l
./rmsamba7.sh :utilisateur lucien existent déjà
./rmsamba7.sh :utilisateur Jean existent déjà
./rmsamba7.sh :utilisateur Valentin existent déjà
./rmsamba7.sh :utilisateur Rayan existent déjà
[?2004hroot@bash:~/tpbash# ./rmsamba7.sh users.txt
[?2004l
userdel: lucien mail spool (/var/mail/lucien) not found
userdel: Jean mail spool (/var/mail/Jean) not found
userdel: Valentin mail spool (/var/mail/Valentin) not found
userdel: Rayan mail spool (/var/mail/Rayan) not found