如何通过终端在Mac上获取活动目录域名 [英] how to get active directory domain name on Mac via Terminal

查看:147
本文介绍了如何通过终端在Mac上获取活动目录域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我试图通过终端用户主体名称获取:Windows中的
我可以运行 whoami / upn,它将输出所有内容。如果用户不在Active Directory下,则为空。因此Windows的whoami对我来说就像是一种魅力。在Mac上的
我找到了一个名为 HOSTNAME的命令。还有一个别名-$ HOSTNAME。如果最终用户绑定到Active Directory,它将输出其名称吗?换句话说-然后我可以调用以下命令:
echo $ USER @ $ HOSTNAME以获取用户主体名称...

basically i am trying to get via Terminal user principal name: username@full.name.of.activedomain.com in Windows i can run "whoami /upn" and it will output everything. or nothing if user is not under Active Directory. so whoami for Windows works like a charm for me. on Mac i found a command called "HOSTNAME". and there is also an alias to it - $HOSTNAME. if end user is binded to Active Directory - will it output its name? in other words - i would then could call this command: echo $USER@$HOSTNAME to get the user principal name...

我可以在终端中使用一些不同的命令或别名?请帮忙。

or maybe there is some different command or alias which i can use in Terminal? please help.

推荐答案

我知道这可能为时已晚。

I know probably this is too late. Still it might help someone in the future.

您可以使用 klist命令检索当前登录用户的userPrincipalName。

You can use "klist" command to retrieve the userPrincipalName for the current logged in user.

这篇关于如何通过终端在Mac上获取活动目录域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆