-
Notifications
You must be signed in to change notification settings - Fork 0
/
UsersGroups.py
61 lines (46 loc) · 1.83 KB
/
UsersGroups.py
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
import os
def get_user():
users = os.system("cat /etc/group")
print(users)
def get_groups():
groups = os.system("cat /etc/group")
print(groups)
def creat_group():
grp = input("Veuillez saisir le nom du groupe à créer : ")
creatGrp = os.system("groupadd " + grp)
print(os.system("cat /etc/group | grep -i " + grp))
def delete_group():
grp = input("Veuillez saisir le nom du groupe à supprimer : ")
creatGrp = os.system("groupdel " + grp)
print(os.system("cat /etc/group | grep -i " + grp))
def creat_user():
user = input("Veuillez saisir le nom de l'utilisateur à créer : ")
creatGrp = os.system("adduser " + user)
print(os.system("cat /etc/passwd | grep -i " + user))
def delete_user():
user = input("Veuillez saisir le nom de l'utilisateur à supprimer : ")
creatGrp = os.system("userdel " + user)
print(os.system("cat /etc/passwd | grep -i " + user))
#English version
def get_user_en():
users = os.system("cat /etc/group")
print(users)
def get_groups_en():
groups = os.system("cat /etc/group")
print(groups)
def creat_group_en():
grp = input("Please enter the name of the group to create : ")
creatGrp = os.system("groupadd " + grp)
print(os.system("cat /etc/group | grep -i " + grp))
def delete_group_en():
grp = input("Please enter the name of the group to delete : ")
creatGrp = os.system("groupdel " + grp)
print(os.system("cat /etc/group | grep -i " + grp))
def creat_user_en():
user = input("Please enter the name of the user to create : ")
creatGrp = os.system("adduser " + user)
print(os.system("cat /etc/passwd | grep -i " + user))
def delete_user_en():
user = input("Please enter the name of the user to delete : ")
creatGrp = os.system("userdel " + user)
print(os.system("cat /etc/passwd | grep -i " + user))