Solved

A script to push Solaris Patches to 200 servers

Posted on 2008-10-31
2
326 Views
Last Modified: 2013-12-27
I have a total of 250 Solaris servers and I am looking for a script to enable me push patches/packages
0
Comment
Question by:benmartins
2 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 22854249
You definitely want a push instead of pull?

There's quite a few options available.  Simplistically, you could just use scp (assuming you have ssh keys setup), eg:
#!/bin/sh

for host in `cat /list/of/hosts`

do

  scp /path/to/patch $host:/patch/dir

done

Open in new window

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22854292
you may use scp or ftp to send the patches to these servers.

make the patches as one file (e.g. with tar)

have the 250 servers names in a file, e.g. myhosts (which has names that are in /etc/hosts or dns).

ftp script myscript:

cat myhosts | while read remotehost
do
    ftp $remotehost <<-END
    cd /dir
    binary
    put filename.tar
    bye
    END
done

- make this script executable:

chmod +x myscript

- For ftp to work without providing any username / password,  use .netrc file in the user's home directory (the one who will run the script). This file should not be readable by others i.e. use
chmod 400 .netrc

The entry in .netrc should be as below:

machine remoteserver
login remoteusername
password mypassword

remoteserver is the server which is the ftp server where you want to sent the file(s)
remoteusername is the remote user login name on the ftp server
mypassword is the password of the remote user on the ftp server

for more info about .netrc, please use man netrc

here, you may put the details of the usernames and passwords of the 250 servers.

for scp,  you need to have similar script but you need to set trust between the 250 servers and the server you are pushing from (so you are not prompted for passwords).

http://waelchatila.com/2005/06/06/1118124232757.html
http://www.cvrti.utah.edu/~dustman/no-more-pw-ssh/

similar to ftp script:

cat myhosts | while read remotehost
do
    scp file.tar username@$remotehost:/remdir
done
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now