| jianyan 回复于:2004-02-03 01:04:43 |
| 读一下/etc/passwd这个文件不就行了,hehe |
| laoxia 回复于:2004-02-03 01:31:49 |
| /etc/group |
| jianyan 回复于:2004-02-03 01:56:59 |
| 楼上的兄弟,
/etc/group里面的东东好像不是很准确啊!!! 并不能给出想要的所有人的ID :) |
| laoxia 回复于:2004-02-03 03:01:39 |
| [quote:eb245b63f6="jianyan"]楼上的兄弟,
/etc/group里面的东东好像不是很准确啊!!! 并不能给出想要的所有人的ID :)[/quote:eb245b63f6] Yes..you are right try this logins -g group_name for example. on my machine ============================= # logins -g staff jkzhang 1005 staff 10 irmiller 1006 staff 10 pxia 1007 staff 10 jbohlke 1008 staff 10 ============================= |
| laoxia 回复于:2004-02-03 03:09:09 |
| [size=18:cf168bc234][b:cf168bc234]Displaying a User's Login Status[/b:cf168bc234][/size:cf168bc234]
Use the logins command to display the status of users who are logged in. Using the logins command with no arguments displays a list of all user and system login aclearcase/" target="_blank" >ccounts. Use the options listed in Table 18-11 to control the output displayed by the logins command. Table 18-11 Options to the logins Command -------------------------------------------------------------------------------- Option Description -a Add two password expiration fields to the display. The fields show how many days a password can remain unused before it automatically becomes inactive as well as the date that the password expires. -d List logins with duplicate UIDs. -m Display multiple group membership information. -o Format the output into one line of colon-separated fields. -p Display logins with no passwords. -s Display all system logins. -t Sort output by login name instead of by UID. -u Display all user logins. -x Print an extended set of information about each specified user. The extended information displays the home directory, login shell, and password aging information, each on a separate line. The password information includes password status (PS for password, NO for no password, or LK for locked). If the login is passworded, status is followed by the date the password was last changed, the number of days required between changes, and the number of days allowed before a change is required. The password aging information shows the time interval during which the user will receive a password expiration warning message at logon before the password expires. -g group Lists all users belonging to the group, sorted by login. You can specify multiple groups as a comma-separated list. -l login Lists the requested login. You can specify multiple logins as a comma-separated list. Depending on the name service lookup types set in /etc/nsswitch.conf, the information can come from the /etc/passwd and /etc/shadow files and other name services. -------------------------------------------------------------------------------- The logins command uses the following syntax: /usr/bin/logins [-admopstux] [-g <group1>,<group2>…] [-l<login1>,<login2>…] You can group options together. When you group options, any login that matches any criteria is displayed. When you combine the –l and –g options, a user is listed only once, even if the user belongs to more than one of the specified groups. -------------------------------------------------------------------------------- NOTE: You must be superuser to run the logins command. |
| jianyan 回复于:2004-02-03 09:01:29 |
| logins 的确是不错不错的东东,楼上还真能查。
但那玩意义好像只能用root才能运行,普通用户不能运行,hehe |
| laoxia 回复于:2004-02-03 09:40:49 |
| > 如何从用户名编程得到其所属的组列表?
groups user_name |
| fudy 回复于:2004-02-03 20:37:24 |
| 各位兄弟,你们说的都不是编程阿 |
| alinker 回复于:2004-02-03 21:47:20 |
| 有awk操作下/etc/passwd
取出相同gid那个field的记录,节取uid 成了 |
| diag 回复于:2004-02-03 23:34:53 |
| 楼主说的那个函数。没人知道 |
| nanaskylead 回复于:2004-02-04 08:52:05 |
| 为什么要用函数实现?命令行能做的东西一样可以写在脚本里啊? |
| diag 回复于:2004-02-04 09:55:18 |
| admintool
是怎么来的? |