Sponsored Content
Full Discussion: Find Default user
Top Forums Shell Programming and Scripting Find Default user Post 302960284 by MadeInGermany on Friday 13th of November 2015 06:19:47 AM
Old 11-13-2015
I get this:
Code:
% cat passwd
root:x:0:0:Super-User:/:/bin/sh
user:x:1000:0:Super-User:/:/bin/sh
% IFS=":" read user _ userid _ _ homedir _ <<< $(grep ".*:.*:1000:" passwd); echo $user; echo $userid
user x 1000 0 Super-User / /bin/sh

% IFS=":" read user _ userid _ _ homedir _ <<< "$(grep ".*:.*:1000:" passwd)"; echo $user; echo $userid
user
1000
% echo $BASH_VERSION
3.2.57(1)-release
%

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can I find a user profile

Hi, I want to know how can i find a user when he has logged in and how many times and days (2 Replies)
Discussion started by: darwinscp@hotma
2 Replies

2. IP Networking

how can i find a user profile

Hi I want to know how can i find a user when he has logged in, at what time and how many days, anyone can help me (1 Reply)
Discussion started by: darwinscp@hotma
1 Replies

3. UNIX for Advanced & Expert Users

Find User

I have a file in my home directory and I want to know all the users who have tried to read the file from my directory and or access the particualr file. Could someone helpme in this as to how I can proceed further? Thanks. (3 Replies)
Discussion started by: shubhranshu
3 Replies

4. Solaris

Find a whether user exists or not.

Hi all, to find a user whether he had an account on AIX box i will use commands like "finger" , "lsuser". I am new to solaris and we are migrating to solaris. now i am using " more /etc/passwd | grep -i <UserID> " to find a user present in that solaris box or not. Are der any similar... (9 Replies)
Discussion started by: firestar
9 Replies

5. AIX

ldapsearch to find DN for a user

How can I do a ldapsearch to find a DN for a user when I know the exact cn for that user out of active directory. I have tried several different commands (hundreds) but need the -b with the full dn to perform the search using ldapsearch from AIX. I am trying to find the OU for a user and the... (3 Replies)
Discussion started by: cchart3
3 Replies

6. HP-UX

Need to find user login name with their First name and last name

I need to find user login name with their First name and last name .Using HP-UX . i used Finger but couldn't able to get ... $ finger ravi.kumar@domain.com ksh: domain.com: not found i tried with finger kumar ravi finger ravi kumar but not able to get It just giving Login name:... (9 Replies)
Discussion started by: girija
9 Replies

7. Shell Programming and Scripting

How to find a string in my user

Hello all, what is the find command to locate the string in my user. string is "ciadev" .this string locate multiple files which in different directories.so please write the find command for this issue.Iam looking forward from you. Thanks Regards Rajkumar G:) (1 Reply)
Discussion started by: rajkumar_g
1 Replies

8. Shell Programming and Scripting

find a user on the system

i am prompting for a name to search. read user if then however, i get this error: please enter a username on the system: fool menu_script2.sh: line 123: (4 Replies)
Discussion started by: icelated
4 Replies

9. Shell Programming and Scripting

Find if a User exist if not create user

What I'm trying to do is write a script in Perl to find a user and if that user exist it would print "User Exist, Pls Try Again". If The user doesn't exist I'm able to create a user with a password. Any suggestions? (3 Replies)
Discussion started by: GoBoyGo
3 Replies

10. Ubuntu

Find: ‘-ls’ is not the name of a known user

I am trying to figure what I am doing wrong here. find . '!' -user $USER -ls andy@7_~/Downloads$ (9 Replies)
Discussion started by: drew77
9 Replies
passwd(4)						     Kernel Interfaces Manual							 passwd(4)

NAME
passwd - Password files DESCRIPTION
A passwd file is a file consisting of records separated by newline characters, one record per user, containing seven colon (:) separated fields. These fields are as follows: User's login name. The default length is 8 characters. User's encrypted password. User's ID User's login group ID General information about the user User's home directory User's login shell The name field is the login used to access the computer account, and the uid field is the number associated with it. They should both be unique across the system (and often across a group of systems) since they control file access. While it is possible to have multiple entries with identical login names and/or identical user gid's, it is usually a mistake to do so. Routines that manipulate these files will often return only one of the multiple entries, and that one by random selection. The login name must never begin with a hyphen (-); also, it is strongly suggested that neither uppercase characters or dots (.) be part of the name, as this tends to confuse mailers. No field may contain a colon (:) as this has been used historically to separate the fields in the user database. The password field is the encrypted form of the password. If the password field is empty, no password is required to gain access to the machine. Because these files contain the encrypted user passwords, they should not be readable by anyone without appropriate privileges. Use the command to edit password entries. This ensures that the hashed password database is rebuilt. If you have enhanced security installed on your system, the password field contains an asterisk (*). The encrypted password is stored in the user's protected password database. The gid field is the group that the user will be placed in upon login. Since the operating system supports multiple groups (see the groups command) this field currently has little special meaning. The gecos field normally contains comma (,) separated subfields as follows: User's full name User's office number User's work phone number User's home phone number This information is used by the finger command. The user's home directory is the full UNIX pathname where the user will be placed on login. The shell field is the command interpreter the user prefers. If the shell field is empty, the Bourne shell (/bin/sh) is assumed. The allowable values for the UID are unsigned numbers from 0 to 65535. The command pwck can be used to verify the accuracy of data entered in the passwd file. EXAMPLES
root:TZVtfX5VbS3KY:0:1:System PRIVILEGED Account,,,:/:/bin/sh adm:*:5:16:Admin Login:/usr/adm:/bin/sh operator:HdgoklKwZOlvU:25:28:System PRIVILEGED Account,,,:/etc/operator: guest:Nologin:-2:-2:anonymous NFS user:/:/bin/date osfuser:If2eoZ6gmghJo:50002:15:Osf User:/usr/users/osfuser:/bin/csh marcy:*:201:20:Marcy Swanson,dev,x1234:/usr/users/marcy:/bin/sh RELATED INFORMATION
Functions: getpwent(3) Commands: login(1), passwd(1), pwck(8), vipw(8) Files: prpasswd(4) delim off passwd(4)
All times are GMT -4. The time now is 07:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy