Linux - display all user info

Where Penguins and Daemons chill together in the warmth of the Sun.

Moderators: SecretSquirrel, notfred

Linux - display all user info

Postposted on Mon Feb 28, 2011 3:50 pm

Is there a command to display all the info about a user - home directory, etc.

Reason I ask: I just installed vsftpd and the Ubuntu documentation says that by default the installer creates user 'ftp' and creates a home directory '/home/ftp' for that user. Well, the user 'ftp' was indeed added to the system, but there is no '/home/ftp' directory. So, now I'm wondering exactly what the ftp user's profile parameters are. I guess I'm looking for something like a hypothetical:

usermod --list ftp
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: Linux - display all user info

Postposted on Mon Feb 28, 2011 6:17 pm

Code: Select all
echo ~ftp
should display the full path of the ftp account's home directory.

Or if you want more info,
Code: Select all
grep <username> /etc/passwd
will show you the raw entry from the system's user list for any user, which contains the numerical user ID, default group ID, full name, home directory path, and default shell. (The name of the file is historical; back in the day, it also used to contain the users' encrypted passwords. Modern *NIX systems no longer do this, since the amount of computing power available on modern systems has made brute force password cracking too easy.)
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 37515
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Linux - display all user info

Postposted on Mon Feb 28, 2011 8:32 pm

Sweet, JBI. Thanks.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: Linux - display all user info

Postposted on Wed Mar 02, 2011 8:05 pm

Code: Select all
egrep ^username /etc/passwd


Otherwise, you're getting all matches in the password file, regardless of position. Useful for people with names like Ed.
A novice asked the master: "What is the true meaning of programming?"
The master replied: "Eat when you are hungry, sleep when you are fatigued, program when the moment is right."
-- The Tao of Programming
bigfootape
Gerbil
 
Posts: 12
Joined: Wed Jun 18, 2003 12:43 pm

Re: Linux - display all user info

Postposted on Wed Mar 02, 2011 8:24 pm

bigfootape wrote:
Code: Select all
egrep ^username /etc/passwd

Otherwise, you're getting all matches in the password file, regardless of position. Useful for people with names like Ed.

Yup. But as long as you're just eyeballing the output (not feeding it to another script to do something automated), it doesn't really matter.

In any case, if we're being pedantic, it should be:
Code: Select all
egrep ^username: /etc/passwd

That way you won't get Edith when you were really looking for Ed. :wink:
(this space intentionally left blank)
just brew it!
Administrator
Gold subscriber
 
 
Posts: 37515
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer


Return to Linux, Unix, and Assorted Madness

Who is online

Users browsing this forum: No registered users and 4 guests