Linux Automation: Difference between revisions

From Coolscript
Jump to navigation Jump to search
Line 18: Line 18:
  #rm mycron
  #rm mycron


=Users and Groups=
Root priviledges for user group
Root priviledges for user group
*/etc/sudoers (use visudo -f)
*/etc/sudoers (use visudo -f)
Line 23: Line 24:
*Add user joe to sudo  
*Add user joe to sudo  
  usermod -a -G sudo joe
  usermod -a -G sudo joe
*Add a system user (no shell)
useradd -M systemuser
*Prevent login
usermod -L systemuser

Revision as of 20:31, 14 December 2020

Setup a proxy server for apt

echo 'Acquire::http::Proxy "http://myserver.com.com:port";' > /etc/apt/apt.conf

Update using apt

  • Possible commands
apt-get -y  upgrade -s
apt-get -y  upgrade -s; logger "APT has been applied"
unattended-upgrade --dry-run -d

Automatic update using crontab

#echo 'MAILTO=""' > mycron
#echo "00 05 * * * apt-get update && apt-get -y upgrade -s | logger 
#sudo crontab mycron
#rm mycron

Users and Groups

Root priviledges for user group

  • /etc/sudoers (use visudo -f)
root    ALL=(ALL:ALL) ALL
  • Add user joe to sudo
usermod -a -G sudo joe
  • Add a system user (no shell)
useradd -M systemuser
  • Prevent login
usermod -L systemuser