Easy network apt

Quick and dirty way to update any server on your network that uses apt package management.

1. Verify you have ssh key access (passwordless to make this easy)

2. Add to each server you wish to update (security on lan only of course):

"sudo visudo -f /etc/sudoers"


# This allows any user in the admin group to

# run the apt-automate script without sudoing

%admin ALL= NOPASSWD: /usr/bin/apt-automate


3. Create a file called apt-automate by issuing the command:

"sudo nano /usr/bin/apt-automate"



# You may put any other custom flags in apt-get

# here as well

apt-get update && apt-get dist-upgrade


4. Issue the command to make the script executable

"sudo chmod +x /usr/bin/apt-automate"

5. On the machine you wish to manage the updates from create a file called

"nano ~/"



# you do not put the local hostname or ip here,

# since the command gets run locally below

hosts="machine1 machine2 machine3"

for i in $hosts;


  • echo updating $i please wait....; ssh $i sudo apt-automate; done;

# comment the below line out if you wish to remove

# the local machine from updating

sudo apt-automate


6. To use, run as a user in the admin group locally.

adopted from


networkapt (last edited 2008-08-06 16:39:27 by localhost)