# A simply shell script to update all remote Redhat Enterprise Linux 5 / CentOS Linux 5 servers
# You must have ssh public and private key installed. This will save a lot of time if you
# have 5-7 servers. The last example shows how to login as a normal user and run sudo 
# to update the same.
# -------------------------------------------------------------------------
# Copyright (c) 2008 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# an array to store all ssh commands
	"ssh root@server1.nixcraft.in -p222 yum update -y"
	"ssh root@server2.nixcraft.in -p333 yum update -y"
	"ssh root@server3.nixcraft.in yum update -y"
	"ssh user1@ -t sudo  '/usr/bin/yum update -y' "
# simply run array item
for c in "${hosts[@]}"

See how to install ssh-keys .

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source, and DevOps topics via:
Category List of Unix and Linux commands
Disk space analyzers df ncdu pydf
File Management cat tree
Firewall Alpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilities NetHogs dig host ip nmap
OpenVPN CentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Manager apk apt
Processes Management bg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searching grep whereis which
User Information groups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPN Alpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • imagine1437 May 12, 2010 @ 2:01

    Thanks. This is very helpful

  • Vamsi Feb 28, 2010 @ 12:31

    thanks for the script ..
    arrays are very useful :D

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.