Last active
August 22, 2018 15:25
-
-
Save wilxsv/4b5fa1c5e9043bc015de60c5334d0da7 to your computer and use it in GitHub Desktop.
Creacion de usuarios para materia de CET115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read line | |
do | |
echo -e "Creando usuarios son password y eliminando la interaccion" | |
adduser --disabled-password --gecos "" $line | |
echo -e "Definiendo el password de cada usuario para ejecutar comandos via BASH sin problemas" | |
echo -e "$PASS\n$PASS" | passwd $line | |
echo -e "Agregando la estructura de directorio y archivo para agregar a cada usuario su llave" | |
su -c "mkdir /home/$line/.ssh/ && touch /home/$line/.ssh/authorized_keys" $line | |
echo -e "Creando una llave ssh para cada usuario por si tiene problemas" | |
su -c "echo -e \"\n\n\n\" | ssh-keygen" $line | |
echo -e "Actulizando las llaves autorizadas a la actual generada" | |
su -c "cat /home/$line/.ssh/id_rsa.pub >> /home/$line/.ssh/authorized_keys" $line | |
done < cet115.lst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bla | |
bla | |
bla |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment