Page 1 of 1

Linux - display all user info

Posted: Mon Feb 28, 2011 3:50 pm
by flip-mode
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

Re: Linux - display all user info

Posted: Mon Feb 28, 2011 6:17 pm
by just brew it!
echo ~ftp
should display the full path of the ftp account's home directory.

Or if you want more info,
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.)

Re: Linux - display all user info

Posted: Mon Feb 28, 2011 8:32 pm
by flip-mode
Sweet, JBI. Thanks.

Re: Linux - display all user info

Posted: Wed Mar 02, 2011 8:05 pm
by bigfootape
egrep ^username /etc/passwd


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

Re: Linux - display all user info

Posted: Wed Mar 02, 2011 8:24 pm
by just brew it!
bigfootape wrote:
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:
egrep ^username: /etc/passwd

That way you won't get Edith when you were really looking for Ed. :wink: