-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiac1.sh
executable file
·77 lines (59 loc) · 1.92 KB
/
iac1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
echo "Criando diretórios..."
mkdir /adm
mkdir /ven
mkdir /sec
mkdir /publico
echo "Criando grupo de usuários..."
groupadd GRP_ADM
groupadd GRP_VEN
groupadd GRP_SEC
echo "Criando usuários..."
shell="/bin/bash"
grupo="GRP_ADM"
usuario="carlos"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
usuario="maria"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
usuario="joao"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
grupo="GRP_VEN"
usuario="debora"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
usuario="sebastiana"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
usuario="roberto"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
grupo="GRP_VEN"
usuario="josefina"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
usuario="amanda"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
usuario="rogerio"
senha=`openssl rand -base64 10`
echo -e $usuario"\n"$senha"\n" >> senhas.txt
useradd $usuario -m -s $shell -p $(openssl passwd -6 $senha) -G $grupo
echo "Ajustando permissões dos diretórios..."
chown root:GRP_ADM /adm
chown root:GRP_VEN /ven
chown root:GRP_SEC /sec
chmod 770 /adm
chmod 770 /ven
chmod 770 /sec
chmod 777 /publico