Sponsored Content
Top Forums Shell Programming and Scripting Shell script to connect to multiple ssh servers Post 302668275 by MaRiOsGR on Monday 9th of July 2012 05:27:42 AM
Old 07-09-2012
Shell script to connect to multiple ssh servers

Hello,

I have access to several linux servers (mostly centos based) located in a DC in another country.
from day to day I need to login to each of them to do some work (they dont have gui/window manager installed, I work only from console), or even to just do a check like df -h for disc usage.

I have stored all the ssh passes to a locked file and each time I have to run putty, copy/paste the pass for each server (I have locked root login, you have to authenticate as a user first then run su)etc etc.

My idea is to create a script (that will be localy in a linux vm) that will

1) just do a complete ssh connection to the server just by typing a command for example the server's name "server1"

2)run a command in a server and give me the ouput, like df -h in "server1"


about the 1st , if straight root connection was enabled it would be easy, but I dont know how to do it now that root login is not permited.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell/perl script to connect to different servers in single login in teradata

Hi, I want to write a shell script to compare two tables in teradata.these tables are present on different servers. I want to connect to both servers in single login in order to fetch and compare the data in one go. Thanks (1 Reply)
Discussion started by: monika
1 Replies

2. Shell Programming and Scripting

shell script for how to connect to a remote server by using ssh

i want to connect to a remote server through ssh. i have to also provide password within that script. after connecting to the remote server i want to do some operations like grep,cd etc can u pls help me to wite a script. Thanks (1 Reply)
Discussion started by: millan
1 Replies

3. Shell Programming and Scripting

Connect two servers in shell script

Hello all, I know that is a question which has made too many times, and I have been looking into the threads but all posted was not sucessfully for me so... I need a shell script which connect two unix servers, but NOT using ssh... Is there another way to do it? I've tried ssh but it didn't... (1 Reply)
Discussion started by: Geller
1 Replies

4. Shell Programming and Scripting

connect to multiple servers using SSH and execute commands

Requirement: Run a shell script with below inputs file name checksum path the script should go to multiple servers (around 35) and verify the input cksum and if there is a mismatch display a simple message to the user that cksum verification failed. host details, user id /... (1 Reply)
Discussion started by: amicableperson
1 Replies

5. Shell Programming and Scripting

Shell script to change the password on multiple servers in linux

Can any one please let me know the shell script to change the password for a particular user on multiple linux servers. (2 Replies)
Discussion started by: s_madras
2 Replies

6. Shell Programming and Scripting

Script to add new users to a group on multiple servers using SSH

Hi Experts, I am new to scripting. We have around 400 Linux servers in our environment. I want to add a new user to a perticular group on all the servers using SSH. Requirements: 1) Need to take the server names from a text file. 2) Login into each server and check whether perticular... (1 Reply)
Discussion started by: Satya1983
1 Replies

7. UNIX for Dummies Questions & Answers

How can we connect multiple servers at a time?

help me (0 Replies)
Discussion started by: sonu pandey
0 Replies

8. Shell Programming and Scripting

Shell script to ping multiple servers

Hi I did the following script to ping multiple servers, but I keep on receiveing duplicate emails for one server that is down: #!/bin/bash date cat /var/tmp/servers.list | while read output do ping -c 1 "$output" > /dev/null if ; then echo "node $output is up" else ... (10 Replies)
Discussion started by: fretagi
10 Replies

9. Shell Programming and Scripting

Shell script for connecting multiple servers and then copying 30 days old files

Shell script for connecting multiple servers and then copying 30 days old files from those server . HI , I have 6 multiple servers pla1,pla2,pla3,pla4,pla5,pla6 1. These six servers have common shared mount point /var/share 2. Running script from /var/share to connect these servers.I... (1 Reply)
Discussion started by: rcroyal88
1 Replies

10. UNIX for Beginners Questions & Answers

Assistance to connect to servers via ssh once and collect various commands into separate variables

Hello, We use as bash script to connect to servers listed in an .csv file to issue commands against these servers and retrieve data to be saved in a .csv file. The data we want to collect is saved in variables. We issue an ssh command for each variable we want to capture. I'm thinking this is... (9 Replies)
Discussion started by: greavette
9 Replies
CHPASS(1)						      General Commands Manual							 CHPASS(1)

NAME
chpass - add or change user database information SYNOPSIS
chpass [ -a list ] [ user ] DESCRIPTION
Chpass allows editing of the user database information associated with user or, by default, the current user. The information is formatted and supplied to an editor for changes. The vi editor will be used unless the environmental variable EDITOR selects an alternate editor. When the editor terminates, the information is re-read and used to update the user database itself. Only the user, or the super-user, may edit the information associated with the user. Only the information that the user is allowed to change is displayed. Possible display items are as follows: Login: user's login name Password: user's encrypted password Uid: user's id Gid: user's login group id Change: password change time Expire: account expiration time Class: user's general classification Home Directory: user's home directory Shell: user's login shell Full Name: user's real name Location: user's normal location Home Phone: user's home phone Office Phone: user's office phone The login field is the user name used to access the computer account. The password field contains the encrypted form of the user's password. The uid field is the number associated with the login field. Both of these fields should be unique across the system (and often across a group of systems) as they control file access. While it is possible to have multiple entries with identical login names and/or identical user id's, it is usually a mistake to do so. Routines that manipulate these files will often return only one of the multiple entries, and that one by random selection. The group field is the group that the user will be placed in upon login. Since this system supports multiple groups (see groups(1)) this field currently has little special meaning. This field may be filled in with either a number or a group name (see group(5)). The change field is the date by which the password must be changed. The expire field is the date on which the account expires. Both the change and expire fields should be entered in the form ``month day year'' where month is the month name (the first three charac- ters are sufficient), day is the day of the month, and year is the year. The class field is currently unused. In the near future it will be a key to a termcap(5) style database of user attributes. The user's home directory is the full UNIX path name where the user will be placed on login. The shell field is the command interpreter the user prefers. If the shell field is empty, the Bourne shell (/bin/sh) is assumed. When altering a login shell, and not the super-user, the user must select an approved shell from the list in /etc/shells. The last four fields are for storing the user's full name, office location, and home and work telephone numbers. The super-user is also allowed to directly supply a user database entry, in the format specified by passwd(5), as an argument to the -a option. This argument must be a colon (``:'') separated list of all the user database fields, although they may be empty. Once the information has been verified, chpass uses mkpasswd(8) to update the user database. This is run in the background, and, at very large sites could take several minutes. Until this update is completed, the password file is unavailable for other updates and the new information will not be available to programs. FILES
/etc/master.passwd The user database /etc/shells The list of approved shells SEE ALSO
login(1), finger(1), getusershell(3), passwd(5), mkpasswd(8), vipw(8) Robert Morris and Ken Thompson, UNIX password security BUGS
User information should (and eventually will) be stored elsewhere. 4th Berkeley Distribution March 12, 1989 CHPASS(1)
All times are GMT -4. The time now is 11:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy