To check is user or group exist in passwd and group file:
getent passwd <user_name>
getent group <group_name>
You could also grep the corresponding files, but this is a much cleaner way of getting entries from administrative database where database is one of aliases, ethers, group, hosts, netgroup, networks, passwd, protocols, rpc, services or shadow.
- sandip's blog
- Login or register to post comments