Extract user accounts and home directory from /etc/passwd.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Extract user accounts and home directory from /etc/passwd.
# 8  
Old 06-11-2014
Many thanks to bakunin who painstakingly crafted a grep based answer. I improved my regex knowledge while trying to understand your answer haha.

Chees.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

SunOS confusing root directory and user home directory

Hello, I've just started using a Solaris machine with SunOS 5.10. After the machine is turned on, I open a Console window and at the prompt, if I execute a pwd command, it tells me I'm at my home directory (someone configured "myuser" as default user after init). ... (2 Replies)
Discussion started by: egyassun
2 Replies

2. UNIX for Dummies Questions & Answers

User's home directory not being created

I am trying to create Oracle user. I will install oracle after that. But my problem is /home/oracle directory is not being created. bash-3.2# useradd -g oinstall -G dba,oper -d /home/oracle -m oracle cp: /home/oracle: Operation not applicable chown: /home/oracle: No such file or directory ... (3 Replies)
Discussion started by: hubatuwang
3 Replies

3. Red Hat

User's home directory

Hi, By default user's home directory will be /home/$user. I want to change it to /javauser/$user. How can I do it? Thanks Jeevan. (5 Replies)
Discussion started by: jredx
5 Replies

4. Solaris

Restricting SFTP user to a defined directory and home directory

Hi, I've created solaris user which has both FTP and SFTP Access. Using the "ftpaccess" configuration file options "guest-root" and "restricted-uid", i can restrict the user to a specific directory. But I'm unable to restrict the user when the user is logged in using SFTP. The aim is to... (1 Reply)
Discussion started by: sftpuser
1 Replies

5. Shell Programming and Scripting

change home directory by modifying passwd

hi How can I change the home directory of a user without using usermod -d command? ( by modifying /etc/passwd) (17 Replies)
Discussion started by: tjay83
17 Replies

6. Shell Programming and Scripting

how to find out the home directory of a user??

Hi all, I would like to know how to find out the home directory of a particular user.. eg, If am the root , then my Home directory will be / if say am just a user logging into the terminal then my home dir would change, so accordingly i would like to know how to find it out... I know that... (7 Replies)
Discussion started by: wrapster
7 Replies

7. Solaris

need script for locked and unused user accounts in /export/home directory

Hi all, i have to need one script: 1. it will capture the unused user accounts in /export/home directory. 2. it will capture the locked user accounts in /export/home directory. Note: locked accounts will show in /etc/passwd like /bin/false --> (instead of ksh it will show false) the... (1 Reply)
Discussion started by: krishna176
1 Replies

8. UNIX for Dummies Questions & Answers

user home directory problem

The home directory for me on my system is on /home/kwon. It was created using "useradd kwon" When i go to change the home directory for a user doing a usermod -d /home/test when they log on it gives them messages saying to generate new ssh keys, and it does. It gives me a thing that says... (1 Reply)
Discussion started by: BangYourWallnut
1 Replies

9. UNIX for Dummies Questions & Answers

resrtrict user to his home directory

Hello How do i restrict a user only to his own directory so that he wont be able to cd to other directories. say for excample there is user called xiamin then xiamin should be restricted to /usr/xiamin only. i am on redhat linux regards Hrishy (4 Replies)
Discussion started by: xiamin
4 Replies
Login or Register to Ask a Question
LOGINS(1)						    BSD General Commands Manual 						 LOGINS(1)

NAME
logins -- display account information SYNOPSIS
logins [-admopstux] [-g groups] [-l logins] DESCRIPTION
The logins utility displays information about user and system accounts. The following options are available: -a Display information about the password change and account expiration times for each account. -d Select accounts with duplicate UIDs. -g groups Select accounts that are members of the specified groups. If multiple group names are specified, they must be separated with com- mas. -l logins Select accounts matching the specified login names. If multiple names are specified, they must be separated with commas. -m Show information about secondary groups. -o Display the information for each account on a single line of colon-separated fields. -p Select accounts with no password. -s Select system accounts. These are currently defined as accounts with UIDs below 1000, plus the ``nobody'' account (UID 65534). -t Sort selected accounts by name rather than by UID. -u Select user accounts. These are currently defined as accounts with UIDs above 1000, except the ``nobody'' account (UID 65534). -x Display information about each account's home directory and shell. If multiple selection options are specified, all accounts matching any of the selection criteria will be displayed. If no selection options are specified, all accounts will be displayed. SEE ALSO
getgrent(3), getpwent(3), group(5), passwd(5), pw(8) HISTORY
The logins utility appeared in FreeBSD 4.10. AUTHORS
The logins utility was written by Dag-Erling Smorgrav <des@FreeBSD.org> based on similar utilities in other operating systems. BSD
March 6, 2004 BSD