Terminal |
name@machine:/$ sudo chmod +x /path/to/save_UsersAndGroups.sh |
Copy the code posted here to save_UsersAndGroups.sh then save.
#!/bin/bash # 0 will list off /home/UserName's # 1 will list off all user accounts (www-data, mysql, daemon, syslog, etc.) allUsers=1; if ; then cat /dev/null > 'UsersAndGroups.log'; fi if ; then gawk -F: '{ print $1 }' /etc/passwd > 'UsersAndGroups.log'; else ls /home > 'UsersAndGroups.log'; fi num=0 for user in `cat UsersAndGroups.log`; do users[$num]=$user; num=$(($num + 1)) done cat /dev/null > 'UsersAndGroups.log'; users_count=${#users[@]}; for (( i=0;i> 'UsersAndGroups.log'; #groups ${users[${i}]}; done
Save Article as PDF![]() | Current URL Address![]() |
Add new comment