免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1522 | 回复: 1
打印 上一主题 下一主题

你知道你你的LOGNAME是如何来的吗? . [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-11-21 16:02 |只看该作者 |倒序浏览
你知道你你的LOGNAME是如何来的吗? .




你知道你的LOGNAME是如何来的吗?我之所以这样问,也是因为刚刚才发现这其间的小秘密。

我们都知道id -u显示的是你当前的uid号码,但是加上那个-n就不同了,下面我们来看看他们的区别:
  1. [root@SYS ~]# id
  2. uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
  3. [root@SYS ~]# id -u
  4. 0
  5. [root@SYS ~]# id-un【-n显示名字而不是id号】
  6. root
  7. [root@SYS ~]#
复制代码
也就是说LOGNAME就是通过id -un来显示的。

Ps:

id小节

=========================================================================
  1. id - print user identity

  2. -a     ignore, for compatibility with other versions

  3. -r, --real
  4.               print the real ID instead of the effective ID, with -ugG

  5. -Z, --context
  6.               print only the security context of the current process

  7. [root@SOR_SYS ~]# id -a
  8. uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
  9. [root@SOR_SYS ~]# id -u
  10. 0
  11. [root@SOR_SYS ~]# id -g
  12. 0
  13. [root@SOR_SYS ~]# id -G
  14. 0 1 2 3 4 6 10

  15. [root@SYS ~]# id -n【发现了吧,这个-n必须得和其他参数,比如说-u,-g,-G联合使用。】
  16. id: cannot print only names or real IDs in default format
  17. [root@SYS ~]# id -un
  18. root
  19. [root@SYS ~]# id -gn
  20. root
  21. [root@SYS ~]# id -Gn
  22. root bin daemon sys adm disk wheel
复制代码
【输出的结果就是所属的组以及附加组】

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
2 [报告]
发表于 2011-11-21 20:13 |只看该作者
这些乱七八糟的帖子都是从哪来转过来的啊
http://bbs.chinaunix.net/thread-3620220-1-2.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP