-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsudoexcept.sh
More file actions
57 lines (39 loc) · 1.26 KB
/
Copy pathsudoexcept.sh
File metadata and controls
57 lines (39 loc) · 1.26 KB
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
$User
echo "Enter username : "
read User
sudo useradd $User
sudo groupadd ServerAdmin
sudo usermod -a -G ServerAdmin $User
touch exceptcommand
cat > exceptcommand << END
%ServerAdmin ALL=NOPASSWD: /usr/sbin/chmod
%ServerAdmin ALL=NOPASSWD: /usr/sbin/chown
%ServerAdmin ALL=NOPASSWD: /usr/bin/mkdir
%ServerAdmin ALL=NOPASSWD: /usr/bin/nano
%ServerAdmin ALL=NOPASSWD: /usr/bin/vi
%ServerAdmin ALL=NOPASSWD: /usr/sbin/service
%ServerAdmin ALL=NOPASSWD: /usr/bin/firewall-cmd
%ServerAdmin ALL=NOPASSWD: /usr/sbin/setenforce
%ServerAdmin ALL=NOPASSWD: /usr/sbin/setsebool
%ServerAdmin ALL=NOPASSWD: /usr/bin/mv
%ServerAdmin ALL=NOPASSWD: /usr/bin/cp
%ServerAdmin ALL=NOPASSWD: /usr/bin/rm
%ServerAdmin ALL=NOPASSWD: /usr/bin/yum
%ServerAdmin ALL=NOPASSWD: /usr/bin/systemctl
%ServerAdmin ALL=NOPASSWD: /usr/sbin/nginx
%ServerAdmin ALL=NOPASSWD: /usr/sbin/restorecon
%ServerAdmin ALL=NOPASSWD: /usr/bin/chcon
%ServerAdmin ALL=NOPASSWD: /usr/sbin/semanage
%ServerAdmin ALL=NOPASSWD: /usr/bin/pm2
%ServerAdmin ALL=NOPASSWD: /usr/bin/npm
%ServerAdmin ALL=NOPASSWD: /usr/bin/yarn
END
sudo mv exceptcommand /etc/sudoers.d
echo "Please create password for user"
sudo passwd $User
chage -d 0 $User
sudo yum remove -y git
cd ..
hostname centos
rm -rf shellscript
echo "Complete!!!"