Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help with credentials when using Grep across multiple servers Post 302945699 by Smorgen on Monday 1st of June 2015 03:57:46 PM
Old 06-01-2015
Question Help with credentials when using Grep across multiple servers

Hello all,

I need some help with a script I have been working on. I was wanting to know if it is possible to add authentication to it for each server it runs across? The credentials are all the same on each server.

This is what I am using so far and it seems to work. I am trying to avoid typing my password each time it trys to grep each server. Not a big deal either way but it would be nice.


Code:
#/bin/bash
echo \ "Log Fetcher"
echo \ "ENTER Value"
read text

for server in [ server1 server2 server3 server4 server5 server6 ]; do echo $server; ssh $server cat /var/opt/blah/blah.log | grep $text;done > /home/blah/blah/blah.log


Last edited by Smorgen; 06-01-2015 at 05:08 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ftp to multiple servers

Hi folks. I am writing a ksh ftp script. The problem is, I need to transfer the files to several different servers. Is there a way to close a connection and move on to the next in one script or do I need to write a separate script for each one? Thanks, kristy (2 Replies)
Discussion started by: kristy
2 Replies

2. Shell Programming and Scripting

rsh to change multiple ip in multiple servers?

good day. i jsut wanted to know what is the best script or the best way changing a lot of Ip's in all servers. Do you have any idea? im using awk to change IP,what if, you have lots of servers. You need to change it one by one? It will take time to change it manually. (2 Replies)
Discussion started by: kenshinhimura
2 Replies

3. Shell Programming and Scripting

Script ftp multiple servers

Hi guys , i have 1 problem and no find what is the problem...:confused:, and .netrc is configured and correct permissions... REMOTE="/home/user" LISTADO=`cat /root/home/user/LISTADO.txt` MACHINE=$(echo $i|awk 'FS="|" {print $1}') for i in $LISTADO do ftp $MACHINE <<TER passive prompt... (2 Replies)
Discussion started by: Esquizo000
2 Replies

4. UNIX for Advanced & Expert Users

Help Me - How to grep in multiple servers

Hi All, I need help , Regarding the keyword search in multiple servers at a time . we are desiging a search website . we have a multiple servers and each of the server have 3 instances having Unix compressed files.Our requirement was we need to search the particular key word for eg. we need to... (7 Replies)
Discussion started by: prasad00124
7 Replies

5. UNIX for Advanced & Expert Users

grep for a line in a file on multiple unix servers

Hi, I need to grep(look) for a line in filename named /tmp/Test on all 90 unix servers. Without logging to each servers manually and grep'ing for the line, is there a way to pull this info in output file thru' the ksh/sh/bash script. Can someone pl. help to create this script for me? Ex.... (3 Replies)
Discussion started by: Mike1234
3 Replies

6. Shell Programming and Scripting

user id creation of multiple servers

Need help in creating a user with passord in mulptiple solaris servers using a script.. (0 Replies)
Discussion started by: ningy
0 Replies

7. Shell Programming and Scripting

Checking running process status using "grep" on multiple servers in load sharing system.

Suppose i have 3 different servers say x,y and z. Im running some process say ABC and 40 instances for the same is being created. In load sharing suppose on server x, 20 instances are running server y, 10 instances are running server z, 10 instances are running. While checking the... (1 Reply)
Discussion started by: ankitknit
1 Replies

8. Shell Programming and Scripting

Grep from multiple patterns multiple file multiple output

Hi, I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command. Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns. Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies

9. UNIX for Beginners Questions & Answers

ssh multiple servers

Hi folks. I'm pretty new to unix, while I'm learning a lot I'm finding bash scripting quite confusing. Im sure it's not really, my head just hasn't clicked with it. Anyway, I need a script to loop the ip addresses stored in a file and run a "pgrep <process>" and return the pid or some... (2 Replies)
Discussion started by: MuntyScrunt
2 Replies

10. UNIX for Beginners Questions & Answers

How to apply the update statement in multiple servers on multiple dbs at a time .?

Hi , Can any please help the below requirement on all multiple servers and multiple dbs. update configuration set value='yes' ;1) the above statement apply on 31 Databases at a time on different Ip address eg : 10.104.1.12 (unix ip address ) the above ip box contains 4 db's eg : db... (2 Replies)
Discussion started by: venkat918
2 Replies
pam_setcred(3PAM)					       PAM Library Functions						 pam_setcred(3PAM)

NAME
pam_setcred - modify/delete user credentials for an authentication service SYNOPSIS
cc [ flag ... ] file ... -lpam [ library ... ] #include <security/pam_appl.h> int pam_setcred(pam_handle_t *pamh, int flags); DESCRIPTION
The pam_setcred() function is used to establish, modify, or delete user credentials. It is typically called after the user has been authen- ticated and after a session has been opened. See pam_authenticate(3PAM), pam_acct_mgmt(3PAM), and pam_open_session(3PAM). The user is specified by a prior call to pam_start() or pam_set_item(), and is referenced by the authentication handle, pamh. The following flags may be set in the flags field. Note that the first four flags are mutually exclusive: PAM_ESTABLISH_CRED Set user credentials for an authentication service. PAM_DELETE_CRED Delete user credentials associated with an authentication service. PAM_REINITIALIZE_CRED Reinitialize user credentials. PAM_REFRESH_CRED Extend lifetime of user credentials. PAM_SILENT Authentication service should not generate any messages. If no flag is set, PAM_ESTABLISH_CRED is used as the default. RETURN VALUES
Upon success, pam_setcred() returns PAM_SUCCESS. In addition to the error return values described in pam(3PAM) the following values may be returned upon error: PAM_CRED_UNAVAIL Underlying authentication service can not retrieve user credentials unavailable. PAM_CRED_EXPIRED User credentials expired. PAM_USER_UNKNOWN User unknown to underlying authentication service. PAM_CRED_ERR Failure setting user credentials. ATTRIBUTES
See attributes(5) for description of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability | Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe with exceptions | +-----------------------------+-----------------------------+ SEE ALSO
pam(3PAM), pam_acct_mgmt(3PAM), pam_authenticate(3PAM), pam_open_session(3PAM), pam_set_item(3PAM), pam_start(3PAM), libpam(3LIB), attributes(5) NOTES
The interfaces in libpam are MT-Safe only if each thread within the multithreaded application uses its own PAM handle. SunOS 5.10 13 Oct 1998 pam_setcred(3PAM)
All times are GMT -4. The time now is 07:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy