Sponsored Content
Full Discussion: Finding just unix user
Top Forums Shell Programming and Scripting Finding just unix user Post 302456231 by Ikon on Thursday 23rd of September 2010 04:59:49 PM
Old 09-23-2010
Code:
MYUSERS=`w -h | awk '{print $1}'`
for user in ${MYUSERS}
do
        if [ $user = "khagan" ]; then
                echo "Username ${user} is logged in."
        else
                echo "Not who your looking for"
        fi
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

finding directories in UNIX

I am accessing a UNIX server via FTP. I want to retieve a file in a directory. What is the UNIX command that I need to view and retrieve files from a directory? (1 Reply)
Discussion started by: yodaddy
1 Replies

2. UNIX for Dummies Questions & Answers

Finding Printer in unix

I am trying to find the list of printers(names) in the network from unix server. can anybody help me . I need the command. Thanks in advance. :) (2 Replies)
Discussion started by: vijisenthil
2 Replies

3. Shell Programming and Scripting

Finding the group to which a user belongs

Is there any command to find to which group u ser belongs (3 Replies)
Discussion started by: radhika03
3 Replies

4. Shell Programming and Scripting

Finding The Number Of Programs That A Given User Running On A TERMINAL

How To Find The Number Of Programs That A User Running ON A GIVEN TERMINAL (4 Replies)
Discussion started by: venkata.ganesh
4 Replies

5. UNIX for Dummies Questions & Answers

finding out user name from an ip

if i know the ip of a computer on the subnet, it it possible to findout the username of the user that is using that system? (4 Replies)
Discussion started by: purest
4 Replies

6. Shell Programming and Scripting

help for shell script of finding shortest substring from given string by user

please give me proper solution for finding a shortest substring from given string if string itself and first char and last char of that substr are also given by user if S="dpoaoqooroo" and FC="o" and LC="o",then shortest substr is "oo" and rest of the string is "dpoaoqroo" i have code but it is... (1 Reply)
Discussion started by: pankajd
1 Replies

7. HP-UX

finding free memory as a non-root user

All, I have a software application that requires to find the free memory on the machine. It should work in a hpux Out of the box - in other words, it should use the basic OS commands which are available on every HP-UX machine like top, vmstat and doesn't require the user to purchase 3rd... (2 Replies)
Discussion started by: sunny8107
2 Replies

8. UNIX for Advanced & Expert Users

Finding user accounts not accessed for a specific number of days

Hi all, Recently I came across a challenge of finding the user accounts lying around on servers and not being used so much. Our client has hundreds of AIX, RedHat, and Solaris servers. For AIX, I have made a script which uses lsuser and a little bit of sed and awk to show the user accounts... (7 Replies)
Discussion started by: admin_xor
7 Replies

9. UNIX for Advanced & Expert Users

Finding a Particular Pattern In UNIX

Hi, Suppose I have a file with many lines as follows. Now I want to find the following questions from the file through shell script or commands. My name is XYZ. XYZ works for GHT and XYZ is part of PES. GHT is a good organization. XYZ knows swimming. XYZ is also very keen in reading. XYZ is a... (2 Replies)
Discussion started by: sktkpl
2 Replies

10. Shell Programming and Scripting

Finding AIX user accounts expired or locked

// AIX 6.1 In need of finding which AIX user accounts will be expired and are locked. I have placed the following parameters under /etc/security/user... (1 Reply)
Discussion started by: Daniel Gate
1 Replies
POSIX_SETUID(3) 							 1							   POSIX_SETUID(3)

posix_setuid - Set the UID of the current process

SYNOPSIS
bool posix_setuid (int $uid) DESCRIPTION
Set the real user ID of the current process. This is a privileged function that needs appropriate privileges (usually root) on the system to be able to perform this function. PARAMETERS
o $uid - The user id. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 posix_setuid(3) example This example will show the current user id and then set it to a different value. <?php echo posix_getuid()." "; //10001 echo posix_geteuid()." "; //10001 posix_setuid(10000); echo posix_getuid()." "; //10000 echo posix_geteuid()." "; //10000 ?> SEE ALSO
posix_setgid(3), posix_seteuid(3), posix_getuid(3), posix_geteuid(3). PHP Documentation Group POSIX_SETUID(3)
All times are GMT -4. The time now is 05:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy