Are there any risks for letting the beyond password to be used with no password?
It is a home computer, with no other users using it, I only use the single default created user when Ubuntu was installed.
I would like to don't have to write at all the sudo password for these commands:
echo 100 > /sys/class/backlight/intel_backlight/brightness
ethtool -s eth0 autoneg off speed 100 duplex full
dhclient eth0
apt-get update && upgrade && dist-upgrade -y
apt-get autoremove && remove && clean && autoclean -y
Thank you.
ANSWER: It seams that these steps resolved this case:
sudo su
Create /usr/local/bin/scriptname
and write the beyond lines in it:
#!/bin/bash
command in here without sudo
# the end of the script's name
_
Create /etc/sudoers.d/scriptname and write the following lines in it:
User_Alias scriptname=username
Cmnd_Alias scriptabreviaton=/home/globalisation/r
scriptname ALL=NOPASSWD: scriptabreviaton
Add at the end of /etc/sudoers
the next two lines:
username ALL=(ALL:ALL) ALL
username ALL=(ALL:ALL) NOPASSWD: /usr/local/bin/scriptname
_
chown root:root /etc/sudoers.d/scriptname
chown root:root /usr/local/bin/scriptname
chmod 0700 /usr/local/bin/scriptname
chmod 0440 /etc/sudoers.d/scriptname
_
From the regular user name:
sudo /usr/local/bin/scriptname
It shouldn't ask for sudo password any more.
Everywhere when it is written "scriptname", "usernme", "scriptabreviaton" every each of them should be the same.