Visit Our UNIX and Linux User Community

Create summery of al users + date

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Create summery of al users + date
# 1  
Old 09-11-2014
Create summery of al users + date


I have problem to write script which can collect users "username" and the time that each user has been created in our machine and store these data in file database.txt

I have searched a lot and found we can see the exact time we create user with:passwd -S username also list user will do with ls

How can I have database data with this sample template?
database.txt :
username1 > 2014 02 12
username2 > 2014 02 10

Last edited by rbatte1; 09-11-2014 at 11:42 AM.. Reason: Added CODE tags and capital letters.
# 2  
Old 09-11-2014
I'm a bit confused as to what you are asking here nimafire.

The output from passwd -S will show you the date that the password was changed most recently, not the creation date. I'm not aware of a way to list creation date. You don't give us your OS or version, so it's a bit difficult to be sure.

I'm not clear what you wish to achieve with a simple ls command.

Can you show us what you have tried to put together so far and perhaps we can steer you around where you are getting stuck.

Please post code, files, input & output/errors in CODE tags so that the are clear to read.

Thanks, in advance,
# 3  
Old 09-11-2014
im using redhat OS - Centos,
i have create tem username so the password modification time of user is as same as the time that it has created in my machine ,
i want to list all user + create time when run script
sh date
# 4  
Old 09-11-2014
Okay, I think I have it.

Red Hat is not CentOS. They are very closely related though.

Assuming that none of your users have logged on and chosen a new password yet, you could do the following:-
  • Using /etc/passwd, loop for each user
    • Display a line for that user and the output from passwd -S
  • Repeat for next user
You can get a list of users by using:-
cut -f1 -d":" /etc/passwd    # First field with delimeter :

Put this in a loop and run the display statement for the details you want.

Does that help?


Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing Date in the file with Create date and timestamp

Hello, I have files that with a naming convention as shown below. Some of the files have dates in the file name and some of them don't have dates in the file name. imap-hp-import-20150917.txt imap-dell-gec-import-20150901.txt imap-cvs-import-20150915.txt imap-gec-import.txt... (8 Replies)
Discussion started by: Saanvi1
8 Replies

2. Shell Programming and Scripting

Create multiple users with individual passwords to users

hi, i am new to shell scripts i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Discussion started by: DONFOX
1 Replies

3. Shell Programming and Scripting

help to create script for added date to list users

hi my friends im asking for the possibility to creat a script in ubuntu for added date to list users for doing this : - search in debug connected user of all connected users - if a new user is connect for the first time to my server the script record the date of the connection and added it... (1 Reply)
Discussion started by: amzioujda
1 Replies

4. Shell Programming and Scripting

Create new users

Hi , i would like to create a new user over unix ,which are these commands to used and which are the directories to handler? Thank you (3 Replies)
Discussion started by: dimitris
3 Replies

5. Solaris

How to create users in NIS

How to create users in NIS server in solaris Thanks in Advance (6 Replies)
Discussion started by: durgaprasadr13
6 Replies

6. Shell Programming and Scripting

summery calculation

Hi All I want to make summery for Date=245Duration=545 Date=245Duration=10 Date=245Duration=278 Date=246Duration=30 Date=246Duration=178 Date=246Duration=414 Date=247Duration=17 Date=247Duration=281 Date=247Duration=9 Date=248Duration=968 Date=248Duration=550 Date=248Duration=1011... (1 Reply)
Discussion started by: nalakaatslt
1 Replies

7. Shell Programming and Scripting

summery calculation

Hi All I want to make summery for Date=245Duration=545 ... (1 Reply)
Discussion started by: nalakaatslt
1 Replies

8. Solaris

Can't create users in /home

Hi Friends,, I installed solaris 10 in vmware just now.I got a simple problem while i want to create users in /home directory.It is saying "cannot create ".So i checked the permission and then i find that the perm to user(root) is r-x.So i tried to change it to rwx using chmod but again i got a... (4 Replies)
Discussion started by: sdspawankumar
4 Replies

9. UNIX Desktop Questions & Answers

How to create users on HP UX????

I new to unix and I'm using a HP UX and I'm logging in as user: root. I wish to create new users by using the 'useradd' command. When I keyed in' useradd -u 101 -g group john', the reply was 'Group group specified with -g does not exist'. I've read the man page on useradd and I still don't... (8 Replies)
Discussion started by: mascotlee
8 Replies

10. Shell Programming and Scripting

create users from template

Create users from template file (0 Replies)
Discussion started by: rijeshpp
0 Replies

Featured Tech Videos