Tag Info

Hot answers tagged

1

Ultimately, Debian's (and therefore Ubuntu's) adduser calls gpasswd: my $gpasswd = &which('gpasswd'); &systemcall($gpasswd, '-a',$existing_user,$existing_group); Debian's adduser was written with the purpose of being a convenient frontend to a range of utilities (it makes use of, at one step or another, useradd, gpasswd, ...


1

A possible solution is for example with awk and reading /etc/shadow and /etc/group (I assume you don't need system users and I am trying to exclude them and locked users): awk -F":" 'NR==FNR { if ($2 !~ /\!/ && $2 !~ /\*/) { m[$1] = ""; } next; } { for (i in m) { if ($4 ~ i || $1 == i) { m[i] = m[i] $1 " ...


1

cat /etc/passwd (filter the contents with grep as per your requirements) Here you go: awk -F':' '{ print $1}' /etc/passwd | while read -r line; do id "$line"; done



Only top voted, non community-wiki answers of a minimum length are eligible