{
    foreach my $machine ($DB->get_all_by_prop(type => 'machine'))
    {
        next if defined $machine->prop('Uid');

        my ($uid, $gid) = (getpwnam($machine->key))[2,3];

        next unless defined $uid;
        $machine->set_prop('Uid', $uid);

        next unless $gid != $uid;
        $machine->set_prop('Gid', $gid);
    }
}
