04-20-2020
Quote:
Originally Posted by
championc
You're an absolute star - thank you so much.
My issue was that I have to run it (exactly the same command request) on 50+ (nearer to 100) devices. So being able to logon to each device and just paste in a script on the commd line is so much simpler that needing to create a file on each device.
Are you saying you're logging in to each "device" and running the script
manually?
You think this would scale?
Why not to invest time/effort into
automating this repetitive task?!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I try to write a shell script that would list all files on a directory and stop when it finds the first item specified on a find or ls command.
How can I tell to the find or ls command to stop when it finds the first ".doc" file for example ?
Thank you (7 Replies)
Discussion started by: davchris
7 Replies
2. Shell Programming and Scripting
Hi,
I have a file generated like this -
1. Fire SQL and store the formatted output in a temp file
echo "select path, empid, age from emp_tbl" | /usr/sql emp_db 2 > count_file | grep vol > tempFile
2. The tempFile looks like this after the above statement
/vol/emp1 0732 ... (9 Replies)
Discussion started by: angshuman_ag
9 Replies
3. Shell Programming and Scripting
Dear all,
I have encountered some problem here. I prompt the user for input and store it into a data file, eg. key in name and marks so the data file will look like this
andrew 80
ben 75
and the next input is carine 90. So the problem here is i want to print... (2 Replies)
Discussion started by: branred
2 Replies
4. Programming
Hi,
I have received an application that stores some properties in a file. The existing struct looks like this:
struct TData
{
UINT uSizeIncludingStrings;
// copy of Telnet data struct
UINT uSize;
// basic properties:
TCHAR szHost; //defined in Sshconfig
UINT iPortNr;
TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies
5. Shell Programming and Scripting
im a newbee to unix.
I have a requirement to compare two files with awk.
file1.txt
a
b
c
d
e
file2.txt
a
b
d
e
here i want to compare each line in file1 with corresponding line in file2 and prinf the line with difference. ie to check
required result as shown below
a=a (dont... (3 Replies)
Discussion started by: kiranps
3 Replies
6. Shell Programming and Scripting
Hi all,
I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like:
<date1>|<data1>|<url1>|<result1>
<date2>|<data2>|<url2>|<result2>
<date3>|<data3>|<url3>|<result3>
<date4>|<data4>|<url4>|<result4>
What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies
7. Shell Programming and Scripting
Hello,
I have some tab delimited text data,
file: final_temp1
aname val
NAME;r'(1,) 3.28584
r'(2,)<tab>
NAME;r'(3,) 6.13003
NAME;r'(4,) 4.18037
r'(5,)<tab>
You can see that the data is incomplete in some cases. There is a trailing tab after the first column for each incomplete row. I... (2 Replies)
Discussion started by: LMHmedchem
2 Replies
8. Shell Programming and Scripting
Hey,
I am trying to compare formated login and logout dates from one user at a host which I have stored in a tmp directory in order to find out the total login time. I need to compare them in order to find overlapping intervals.
At first I tried to store each log in and logo date in an array... (3 Replies)
Discussion started by: Mumu123
3 Replies
9. UNIX for Beginners Questions & Answers
Dear all,Zabbix version : 2.4 (yes, I know, upgrading soon - honest)
Server OS version : CentOS 6, 64-bit (CentOS 7 with the Zabbix upgrade)I've got a large log file that I would like to read by an external process. It's basically the same as reading the item value on a web-page. I have... (5 Replies)
Discussion started by: rbatte1
5 Replies
10. Shell Programming and Scripting
Hello,
I have a src code file where I need to uncomment many lines.
The lines I need to uncomment look like,
C CALL l_r(DESNAME,DESOUT, 'Gmax', ESH(10), NO_APP, JJ)
The comment is the "C" in the first column. This needs to be deleted so that there are 6 spaces preceding "CALL".... (7 Replies)
Discussion started by: LMHmedchem
7 Replies
LEARN ABOUT LINUX
pam_listfile
PAM_LISTFILE(8) Linux-PAM Manual PAM_LISTFILE(8)
NAME
pam_listfile - deny or allow services based on an arbitrary file
SYNOPSIS
pam_listfile.so item=[tty|user|rhost|ruser|group|shell] sense=[allow|deny] file=/path/filename onerr=[succeed|fail] [apply=[user|@group]]
[quiet]
DESCRIPTION
pam_listfile is a PAM module which provides a way to deny or allow services based on an arbitrary file.
The module gets the item of the type specified -- user specifies the username, PAM_USER; tty specifies the name of the terminal over which
the request has been made, PAM_TTY; rhost specifies the name of the remote host (if any) from which the request was made, PAM_RHOST; and
ruser specifies the name of the remote user (if available) who made the request, PAM_RUSER -- and looks for an instance of that item in the
file=filename. filename contains one line per item listed. If the item is found, then if sense=allow, PAM_SUCCESS is returned, causing the
authorization request to succeed; else if sense=deny, PAM_AUTH_ERR is returned, causing the authorization request to fail.
If an error is encountered (for instance, if filename does not exist, or a poorly-constructed argument is encountered), then if
onerr=succeed, PAM_SUCCESS is returned, otherwise if onerr=fail, PAM_AUTH_ERR or PAM_SERVICE_ERR (as appropriate) will be returned.
An additional argument, apply=, can be used to restrict the application of the above to a specific user (apply=username) or a given group
(apply=@groupname). This added restriction is only meaningful when used with the tty, rhost and shell items.
Besides this last one, all arguments should be specified; do not count on any default behavior.
No credentials are awarded by this module.
OPTIONS
item=[tty|user|rhost|ruser|group|shell]
What is listed in the file and should be checked for.
sense=[allow|deny]
Action to take if found in file, if the item is NOT found in the file, then the opposite action is requested.
file=/path/filename
File containing one item per line. The file needs to be a plain file and not world writable.
onerr=[succeed|fail]
What to do if something weird happens like being unable to open the file.
apply=[user|@group]
Restrict the user class for which the restriction apply. Note that with item=[user|ruser|group] this does not make sense, but for
item=[tty|rhost|shell] it have a meaning.
quiet
Do not treat service refusals or missing list files as errors that need to be logged.
MODULE TYPES PROVIDED
All module types (auth, account, password and session) are provided.
RETURN VALUES
PAM_AUTH_ERR
Authentication failure.
PAM_BUF_ERR
Memory buffer error.
PAM_IGNORE
The rule does not apply to the apply option.
PAM_SERVICE_ERR
Error in service module.
PAM_SUCCESS
Success.
EXAMPLES
Classic 'ftpusers' authentication can be implemented with this entry in /etc/pam.d/ftpd:
#
# deny ftp-access to users listed in the /etc/ftpusers file
#
auth required pam_listfile.so
onerr=succeed item=user sense=deny file=/etc/ftpusers
Note, users listed in /etc/ftpusers file are (counterintuitively) not allowed access to the ftp service.
To allow login access only for certain users, you can use a /etc/pam.d/login entry like this:
#
# permit login to users listed in /etc/loginusers
#
auth required pam_listfile.so
onerr=fail item=user sense=allow file=/etc/loginusers
For this example to work, all users who are allowed to use the login service should be listed in the file /etc/loginusers. Unless you are
explicitly trying to lock out root, make sure that when you do this, you leave a way for root to log in, either by listing root in
/etc/loginusers, or by listing a user who is able to su to the root account.
SEE ALSO
pam.conf(5), pam.d(5), pam(7)
AUTHOR
pam_listfile was written by Michael K. Johnson <johnsonm@redhat.com> and Elliot Lee <sopwith@cuc.edu>.
Linux-PAM Manual 06/04/2011 PAM_LISTFILE(8)