?
Solved

USER ACCOUNT PROFILE (LINUX)

Posted on 2011-10-14
3
Medium Priority
?
295 Views
Last Modified: 2012-05-12
Hi, I need to collect information for user accounts on lots of servers.

Which command can I use to get all these informaion at once?


• Username
• Login
• Status of the account
• Profil
• Date of last connection
0
Comment
Question by:cismoney
  • 2
3 Comments
 
LVL 4

Expert Comment

by:Christopher Raymond Mendoza
ID: 36967674
You can use finger for this.

Including it in a bash script may be be useful for multiple users.
0
 
LVL 9

Accepted Solution

by:
pritamdutt earned 2000 total points
ID: 36967683
You may not be able to extract this information at one go but you can create a shell script like a sample given below

for x in `cat /etc/passwd`
do
Login=`echo $x | cut -f 1 -d ':'`
UserName=`echo $x | cut -f 5 -d ':'`
LoginStatus=`passwd -S $Login | cut -f 2 -d ' '`
Profile=`echo $x | cut -f 6 -d ':'`
LastLogin=`last $Login | head -n 1 | tr -s ' ' | cut -f 5- -d ' '`

echo "$Login|$UserName|$LoginStatus|$Profile|$LastLogin"
done

Open in new window

0
 
LVL 9

Expert Comment

by:pritamdutt
ID: 36967698
Please note some options for commands last and passwd could be different across linux variants.


Hope this helps.

Regards,
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question