Local User


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Local User
# 1  
Old 08-19-2011
Bug Local User

How to fetch only local user without duplication from /etc/passwd using scripting??
# 2  
Old 08-19-2011
More explanation needed

Perhaps it is me but I have no idea what you want to achieve. Please give us more facts!
# 3  
Old 08-20-2011
How find Local User

cat /etc/passwd contains:
Code:
root:!:0:0::/:/usr/bin/ksh
daemon:!:1:1::/etc:
bin:!:2:2::/bin:
sys:!:3:3::/usr/sys:
adm:!:4:4::/var/adm:
uucp:!:5:5::/usr/lib/uucp:
nobody:!:4294967294:4294967294::/:
lpd:!:9:4294967294::/:
imnadm:!:200:200:897/C///Donna B Krystal/SVC,6124395,Donna.B.Krystal@xyz.com,[UTT Rsged 2011-07-05],:/home/imnadm:/usr/bin/ksh
nuucp:!:7:5:uucp login user:/var/spool/uucppublic:/usr/sbin/uucp/uucico
lp:!:11:11::/var/spool/lp:/bin/false
invscout:!:201:1::/var/adm/invscout:/usr/bin/ksh
snapp:!:177:13:snapp login user:/usr/sbin/snapp:/usr/sbin/snappd
dnye:!:40001:1:<iamtag>35-90 Disabled 31/03/2010 <iamtag>:/amex/home/dnye:/bin/ksh
dwins25d:!:40006:1:631/I/089655/ABC/Leopoldo Lourenco Deppe/USR,C1506218,leodep@br.xyz.com,<iamtag>QEV Reassigned 16/09/2009<iamtag>,:/dwinst/dwins25d:/bin/ksh
dwins26d:!:40008:1:631/I/089655/ABC/Leopoldo Lourenco Deppe/USR,C1506218,leodep@br.xyz.com,<iamtag>QEV Reassigned 16/09/2009<iamtag>,:/dwinst/dwins26d:/bin/ksh

In above text,/etc/passwd contains processes and local user like Donna.B.Krystal
So,how to get local user only.Smilie

Last edited by Scott; 08-20-2011 at 02:50 AM.. Reason: Please use code tags
# 4  
Old 08-20-2011
All users that have shell:
Code:
awk -F: '$7 ~ "sh$" {print $1}' /etc/passwd

All users that have shell and description:
Code:
awk -F: '$5 && $7 ~ "sh$" {print $1}' /etc/passwd


Last edited by yazu; 08-20-2011 at 04:14 AM.. Reason: better
# 5  
Old 08-20-2011
MySQL Thanks

Thanks yazu
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Pam.d and make difference between AD User and local user on Linux

Hello, i configured rhel linux 6 with AD directory to authorize windows users to connect on the system and it works. i have accounts with high privileges (oracle for example) if an account is created on the AD server i would to block him. I looked for how to do, for the moment all the... (3 Replies)
Discussion started by: vincenzo
3 Replies

2. Shell Programming and Scripting

How to Switch from Local user to root user from a shell script?

Hi, I need to switch from local user to root user in a shell script. I need to make it automated so that it doesn't prompt for the root password. I heard the su command will do that work but it prompt for the password. and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies

3. UNIX for Dummies Questions & Answers

NIS user in local group

I have root access on a linux (RH5.4) server within an NIS setup that I don't control. I have an NIS account that creates directories on my local node that I want to be writable by my local apache account. The NIS account is only a member of the "users" group and the local apache account is... (1 Reply)
Discussion started by: clindseysmith
1 Replies

4. Solaris

Cant ssh for a local user

Here is the log im pasting for verbose ssh: -bash-2.05b$ ssh -v qa_fnp@10.41.11.23 OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Rhosts Authentication disabled, originating port will... (5 Replies)
Discussion started by: kirtikjr
5 Replies

5. Shell Programming and Scripting

switch user from local user to root in perl

Hi Gurus, I have a script that requires me to switch from local user to root. Anyone who has an idea on this since when i switch user to root it requires me to input root password. It seems that i need to use expect module here, but i don't know how to create the object for this. ... (1 Reply)
Discussion started by: linuxgeek
1 Replies

6. UNIX for Advanced & Expert Users

Determining if user is local-user in /etc/passwd or LDAP user

Besides doing some shell-script which loops through /etc/passwd, I was wondering if there was some command that would tell me, like an enhanced version of getent. The Operating system is Solaris 10 (recent-ish revision) using Sun DS for LDAP. (5 Replies)
Discussion started by: ckmehta
5 Replies

7. OS X (Apple)

Ho do I masquerade the "user@user.local" address in mail/mailx?

Hi, I'm brand new here and looking for a solution: I'm using mail or mailx. The default reply address is «myshortusername@mylongusername.local» which makes absolutely no sense for anybody receiving my emails. But how do I change it? There seem to be many solutions but none for Mac OS X.... (0 Replies)
Discussion started by: gczychi
0 Replies

8. UNIX for Dummies Questions & Answers

local user ip

how can i find my own ip address from unix. command like who -x .this would provide all the ip address but i need to list only current user ip address. who am i command does not display the ip. (9 Replies)
Discussion started by: naushad
9 Replies

9. UNIX for Dummies Questions & Answers

local user ip

how can i find my own ip address from unix. command like who -x .this would provide all the ip address but i need to list only current user ip address. who am i command does not display the ip. (1 Reply)
Discussion started by: naushad
1 Replies

10. UNIX for Advanced & Expert Users

How to prevent local root from su to an NIS user?

We have a shared development box, running Solaris 10 that is an NIS client, all the developers have local root password. If they know the NIS uid of another user, they can just do % useradd -u <uid> login And then log in as that user and have full access to his files in his home directory. ... (3 Replies)
Discussion started by: nfw
3 Replies
Login or Register to Ask a Question