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
SYNC-ACCOUNTS-CREATEUSER(8)					 chiark utilities				       SYNC-ACCOUNTS-CREATEUSER(8)

NAME
sync-accounts-createuser - helper/hook program for sync-accounts SYNOPSIS
SYNCUSER_CREATE_var=value... sync-accounts-createuser DESCRIPTION
sync-accounts-createuser is invoked by sync-accounts when sync-accounts is creating a local account. It must perform all of the tasks involved with local account creation except for the actual changes to the password, shadow and group data- bases. At the very minimum, it must create the new account's home directory (with appropriate permissions). The supplied sync-accounts-createuser script does exactly that. It may also suggest to sync-accounts modifications to the new account's passwd entry. INVOCATION
When sync-accounts-createuser is invoked, the passwd and group entries will not yet have been set up, so it may not rely on them. sync- accounts-createuser will not be supplied with any arguments. However, the following environment variables will be set, giving details about the account to be created: SYNCUSER_CREATE_USER SYNCUSER_CREATE_UID SYNCUSER_CREATE_GID SYNCUSER_CREATE_COMMENT SYNCUSER_CREATE_HOME SYNCUSER_CREATE_SHELL RESULTS
sync-accounts-createuser should usually produce no output. It can inhibit the creation of the user by outputting a single line not containing a colon; in this case, a diagnostic message will be written to sync-accounts's logfile, and the user will be skipped. Alternatively, it may write out an alternative password file entry, in which case sync-accounts will use the supplied data for the local passwd file instead of that from the remote host. The line should be in Sys-V passwd file format (regardless of localformat or remotefor- mat settings). The username field should be taken from SYNCUSER_CREATE_USER, and the password field should be x. EXIT STATUS
0 All went well, or we wrote a line without a colon to say that the account should not be created. any other There were serious problems and sync-accounts should bomb out immediately. FILES
None. ENVIRONMENT
See above. BUGS
The supplied sync-accounts-createuser does not check that it was not supplied with any arguments; nor does it check that the SYNCUSER_CRE- ATE_* variables are set, or have sensible values. AUTHOR
sync-accounts-createuser and this manpage were written by Ian Jackson <ian@chiark.greenend.org.uk>. They are Copyright 1999-2002 Ian Jack- son <ian@davenant.greenend.org.uk>. This manpage forms part of the sync-accounts package. sync-accounts-createuser and the sync-accounts package are free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, consult the Free Software Foundation's website at www.fsf.org, or the GNU Project website at www.gnu.org. SEE ALSO
sync-accounts(8), sync-accounts(5), passwd(5) Greenend 14th July 2002 SYNC-ACCOUNTS-CREATEUSER(8)