forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_sudo.sh
More file actions
executable file
·22 lines (20 loc) · 838 Bytes
/
add_sudo.sh
File metadata and controls
executable file
·22 lines (20 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# New sudoers format
if [ ! -e '/etc/sudoers.d/admin' ]; then
if [ ! -d '/etc/sudoers.d' ]; then
mkidr /etc/sudoers.d
chmod 750 /etc/sudoers.d
fi
echo '# Created by vesta update-trigger' > /etc/sudoers.d/admin
echo 'Defaults env_keep="VESTA"' >> /etc/sudoers.d/admin
echo 'Defaults:admin !syslog' >> /etc/sudoers.d/admin
echo 'Defaults:admin !requiretty' >> /etc/sudoers.d/admin
echo 'Defaults:root !requiretty' >> /etc/sudoers.d/admin
echo '' >> /etc/sudoers.d/admin
echo 'admin ALL=(ALL) ALL' >> /etc/sudoers.d/admin
echo 'admin ALL=NOPASSWD:/usr/local/vesta/bin/*' >> /etc/sudoers.d/admin
chmod 440 /etc/sudoers.d/admin
if [ -z "$(grep /etc/sudoers.d /etc/sudoers)" ]; then
echo -e "\n#includedir /etc/sudoers.d" >> /etc/sudoers
fi
fi