Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: printing out users without home directories

by huck (Parson)
on May 16, 2018 at 03:30 UTC ( #1214605=note: print w/replies, xml ) Need Help??


in reply to printing out users without home directories

What does "user" mean? do system accounts qualify? The following tests all entries from getent passwd

use strict; use warnings; my @passwd_entries; open (USERS, '-|' , 'getent passwd' ) or die $!; @passwd_entries = <USERS>; close USERS; for my $line (@passwd_entries){ my @parts=split(':',$line); unless ($parts[5]){print $parts[0].' '."No home listed\n";} else { unless (-d $parts[5]) {print $parts[0].' '."dir ".$parts[5]." no +t found\n";} } }
see http://www.linfo.org/etc_passwd.html for the layout of the password file.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1214605]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-12-11 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many stories does it take before you've heard them all?







    Results (55 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!