summaryrefslogtreecommitdiff
path: root/root_scripts/sudo_install_config.sh
blob: c4b77303144543683574b7dc19097818fab47a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# Craig Jennings <c@cjennings.net>
# FreeBSD script to install and config sudo

# exit if not root
if ! [ $(id -u) -eq 0 ]
then
	echo "Must be run as root. Exiting."
	exit
fi 

# install sudo 
pkg install -y sudo

# backup original file
cp /usr/local/etc/sudoers /usr/local/etc/sudoers.orig

sed 's/^# *%wheel ALL=(ALL:ALL) NOPASSWD: ALL/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' \
/usr/local/etc/sudoers > /usr/local/etc/sudoers.tmp
visudo -c -f /usr/local/etc/sudoers.tmp && mv /usr/local/etc/sudoers.tmp /usr/local/etc/sudoers