10-09-2009
Script to find systems logged in with a particular userid
Hello All,
I need to design a script to get all the systems names(IP Addresses) logged in with a particular userid say 'xyz' from different terminals. This is to track the use of the particular userid and take action if it is being misused.
The script would accomplish the following steps:
1. the script should run at all times
2. it should find out who all are logged in with username say 'xyz' with the system names(IP Addresses)
3. it should constantly write that with timestamp to a file
4. after each 24 hours it should send a mail to a email address, say :
admin@abc.com with the file as attachment.
Any help will be much appreciated.
Thanks in Advance!!
with warm regards,
Himadri S Mazumder
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
for secure access purposes I want to know where somebody logs in
working in K shell
I have
who am i= giving user and terminal =gxb pts/4 Jan 22 15:0
finger user => gives all sessions of user
=
Login name: gxb
Directory: /home/gxb ... (17 Replies)
Discussion started by: ghislain
17 Replies
2. Shell Programming and Scripting
Hi,
can u say to display the number of users that logged before me.
thanks (10 Replies)
Discussion started by: shanshine
10 Replies
3. Solaris
Hi,
How do I find who logged in last 30 days? I have last command command, but is there any option to find only last 30 days? Thanks in advance. (0 Replies)
Discussion started by: mokkan
0 Replies
4. Ubuntu
Hi,
I need to find out who are all the users logged out recently or some minutes or some hours ago.
:b: (4 Replies)
Discussion started by: balan_mca
4 Replies
5. Shell Programming and Scripting
For the first 4 users only that are currently logged in output their effective user id.
It's not important the order in which each logged in i just want to have the top 4.
Same question as here...... (0 Replies)
Discussion started by: whyatepies
0 Replies
6. UNIX for Dummies Questions & Answers
For the first 3 users only that are currently logged in output their effective user id.
thank you. (6 Replies)
Discussion started by: whyatepies
6 Replies
7. Shell Programming and Scripting
i have about 20 different users submitting a web form that executes a unix script in the background that sets EXECUTIONUSER to their unix id. i would like to use $EXECUTIONUSER to set their email address as EMAILADDR. of course their unix id does not match their email name either. for example:
... (3 Replies)
Discussion started by: crimso
3 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I need to find the users logged in the system beside me.
as
uname -u
gives all the user and
uname -um
gives the current user on system.
How can i get result of uname -u minus uname -um .
I want to do it in one line.
tried with grep but not successful. (6 Replies)
Discussion started by: kailash19
6 Replies
9. Shell Programming and Scripting
Hi Guys,
I have one script which is used to add new user in the system.
This is how we add new user in system:-
sudo /opt/local/bin/new-user 114 ranivarm "Rani Varma(Libo Technical User)" INC00001111
Where
114:-is the site id
ranivarm:- is userid
"Rani Varma(Libo Technical User)" :-... (11 Replies)
Discussion started by: manalisharmabe
11 Replies
10. Shell Programming and Scripting
Dear All,
I need your help in finding out users not logged in to linux system for more than 90 days. I found a script from our forum i am getting error while using that.
from the code i have debugged line by line to see where i am getting the problem. i found out the below line i am getting... (5 Replies)
Discussion started by: Sachinlinux
5 Replies
LEARN ABOUT OSX
pthread_setugid_np
PTHREAD_SETUGID_NP(2) BSD System Calls Manual PTHREAD_SETUGID_NP(2)
NAME
pthread_setugid_np -- Set the per-thread userid and single groupid.
SYNOPSIS
#include <sys/types.h>
#include <sys/unistd.h>
int
pthread_setugid_np(uid_t uid, gid_t gid);
DESCRIPTION
pthread_setugid_np() changes the current thread's effective, real, and saved userid and groupid to the requested userid and groupid ( uid and
gid , respectively) and clears all other groupids.
uid can be the current real userid, KAUTH_UID_NONE, or, if the caller is privileged, any userid. gid can be the current real groupid or, if
the caller is priviledged, any single groupid.
Setting uid to KAUTH_UID_NONE means to "revert to the per process credential".
CAVEATS
Temporarily restoring root privileges for a non-privileged process is only possible on a per-process basis and not a per-thread basis.
pthread_setugid_np() is not intended as a privilege escalation mechanism.
Do not use pthread_setugid_np.2() in a security sensitive situation.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned and the global variable errno is set to indicate the error.
ERRORS
pthread_setugid_np() fails if one or more of the following are true:
[EPERM] The calling process does not have the correct credentials to set the override identity (i.e. The current credentials do
not imply "super-user").
[EPERM] If uid is set to KAUTH_UID_NONE, the current thread must already be assuming another identity in order to revert back.
[EPERM] The current thread cannot already be assuming another identity.
SEE ALSO
setuid(2) setgid(2) seteuid(2) setegid(2)
BSD
October 1, 2008 BSD