Shell script to Finding ALL Superuser ( root ) Accounts under UNIX / Linux OSes
Posted in Monitoring
In Unix-style computer operating systems, root is the conventional name of the user who has all rights or permissions in all modes (single- or multi-user). The root user can do many things an ordinary user cannot, such as changing the ownership of files and binding to ports numbered below 1024.
It is never good practice for anyone to use root as their normal user account because simple typographical errors in entering commands can cause major damage to the system. It is recommended to create a normal user account instead and then use the su command to switch when necessary. Some use the sudo utility instead, which allows a measure of graduated access. Following script find out all root user account on system.
#!/bin/bash # Shell script to Finding ALL Superuser Accounts # Useful to improve system security. # Copyright (c) 2005 nixCraft # This script is licensed under GNU GPL version 2.0 or above # For more info, please visit: # http://cyberciti.biz/shell_scripting/bmsinstall.php # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- grep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}'
Download - Email this to a friend - Printable version
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: /etc/passwd, 0 uid, awk command, computer operating systems, conventional name, find root user, grep command, linux, ports, root account, shell scripting, superuser, superuser accoumt, system security, unix, unix style, zero uid ~ Last updated on: April 10, 2008

