Try this, not tested. I am assuming that ssh passwordless is setup
Code:
for h in AIXMC01 AIXMC02 AIXMC03 AIXMC04
do
ssh $h lsattr -Elsys0 | awk -v h=$h '
BEGIN { print "Hostname Modelname SerialID" }
$1=="systemid"{s=$2}
$1=="modelname"{m=$2}
END {print h,m,s}'
done
Each box has username and password and password changes every 60 days; I can hardcode the username and passwd.
Thanks,
---------- Post updated at 10:49 AM ---------- Previous update was at 10:43 AM ----------
If run the script just for one box AIXMC01 (local; not remote) it prompt for passwd.
---------- Post updated at 10:49 AM ---------- Previous update was at 10:49 AM ----------
If run the script just for one box AIXMC01 (local; not remote) it prompt for passwd.
---------- Post updated at 11:00 AM ---------- Previous update was at 10:49 AM ----------
The problem is i cant hardcode the passwd for each box using my own userid; each box use secure ID.
secure ID contain 6digit + PIN.
But the best solution is I can get root passwd for each box;
I would like to hard code root passwd; root passwd dont required secure ID but they changes every 30 days; when they change I will change the script.
You don't have to hardcode the password. Keys are a separate mechanism. Changing the password doesn't break the key. Google 'passwordless ssh' and you'll find hundreds of examples.
This is much easier than trying to inject plaintext passwords into a script, too, because ssh(and most other sane authentication systems) is designed to prevent that for security reasons.
Actually I found a way to ssh without passwd to any remote boxes.
the following command " sudo su - "
now please help me to to put this logic (sudo su - ) in above script so that I can access each boxes.
As I mentioned passwordless ssh already in place.
When I enter : sudo su -
I can ssh to any boxes I like.
I need help to add sudo su - logic in the script for each boxes.
Code:
for h in AIXMC01 AIXMC02 AIXMC03 AIXMC04
do
ssh $h lsattr -Elsys0 | awk -v h=$h '
BEGIN { print "Hostname Modelname SerialID" }
$1=="systemid"{s=$2}
$1=="modelname"{m=$2}
END {print h,m,s}'
done
Thanks,
---------- Post updated at 03:00 PM ---------- Previous update was at 02:45 PM ----------
the above script works fine when I logged as a root. the only problem I have
I dont want the heading for each boxes. As you can see "Hostname Modelname SerialID
" is repeating
Dear users,
SUSE 10 sp3 and SUSE 11.
I made configuration changes in '/etc/syslog-ng/syslog-ng.conf'
to move SYSLOG content to LogRhythm.
This is what I changed in the file.
Un-comment out the following lines
#Enable this and admop IP to send log messages to... (10 Replies)
I m trying to run a batch script in remote desktop which executes unix commands on the unix server...the problem is i wnt the output in HTML format.so in my batch script i m giving the cmd like
ssh hostname path ksh HC_Report.ksh>out.html
...but it generates the HTML file in
remote desktop .i... (2 Replies)
Hi All ,
In my environment we have 12 SAN switches .Culd u pls help me for below queries .
would like to telnet to all switches and collect information in daily basis with "switchstatus" command and store the output under /tmp/ folder on systemA .
To keep passwords of 12switches in a... (1 Reply)
hi
I am very new to UNIX.
I need to retrieve data from a unix system and store it and display as output on a windows system.
Initiation of procedure is through JAVASCRIPT-based buttons on a HTML page.
This should cause a set of commands to run which colllect data from a unix based server and... (1 Reply)
How can my unix shell script automatically connect to remote host?
Assume that there is a remote host called "rhost". When I connect to that host i give the command "telnet rhost".
It then asks me for my id and password. Once i give it connects there.
I want to automate these steps. I want... (8 Replies)
Dear All,
We are going for Disaster Recovery project, the vendor asked for more details about how much is the daily data changes only. using sar / iostat can any one help me to collect this ?!
Note: only I need the changed data size not the daily increasing data. this is to know how much... (1 Reply)
Hi !
Please tell me how to get radio buttons, text boxes , check boxes , option buttons , pull down menus in C++ on Unix.
I think it would be done using curses.h ..but that's all i know.
TIA,
Devyani. (3 Replies)