linux 的网络组/域的等效命令?

equivalent command of net group /domain for linux?

我找了好久,怎么也找不到。

首先,是否有等效命令:

wmic computersystem get domain

其中return当前用户主域。

我一直在想是否有一个等效的命令:

net group /domain

一个命令,returns 用户当前域的所有全局组。

到目前为止,我一直在尝试在 /etc/ 中搜索不同的网络文件,目前我找到的唯一相关文件是 reslov.conf,它包含所有 DNS,它可能包含更多信息比我实际需要的。 [这意味着我必须查询那里的每个域以及 'ask' 用户是否与该域相关联] 有没有比这更有效的方法?

谢谢。

你提到的域的概念有歧义。

wmic computersystem get domain 等价于 dnsdomainname

这不是 return 当前用户主域(Active Directory 域或其他域)的命令。

给定 Unix 用户映射到 samba 的 Active Directory 域的命令是

wbinfo --sid-to-fullname `wbinfo --uid-to-sid username` | awk -F "\" '{print }'. 

另见以下相关Whosebug question.

net group /domain 的等价物是 net ads group -w <domainname>,由 Samba 提供。 net group /domain 不适用于您所描述的当前用户,如果您想要与您的描述等效的命令,则需要将 -U <username> 添加到给定的等效命令中。

如果您只是在寻找一个命令来获取当前用户的组,那么根据 Winbind 配置,getent group | grep username 用于 unix 组和现有的 Windows 组到 Unix 组,或者

wbinfo --user-domgroups `wbinfo --uid-to-sid username` 

域中当前用户的全局组。

Un*x 主机名

hostname -f
host.domain

host host.domain
host.domain has address 192.168.1.35

参见 man hostman digman hostname。另请参阅手册页中的 另请参阅 部分。

Windows net 命令下 Linux

您必须至少安装 samba-client 个软件包。安装 samba 套件后,您将能够 运行 linux 的 net 命令:

net help
Usage:
net rpc             Run functions using RPC transport
net rap             Run functions using RAP transport
net ads             Run functions using ADS transport
net file            Functions on remote opened files
net share           Functions on shares
net session         Manage sessions
net server          List servers in workgroup
net domain          List domains/workgroups on network
net printq          Modify printer queue
net user            Manage users
net group           Manage groups
net groupmap        Manage group mappings
net sam             Functions on the SAM database
net validate        Validate username and password
net groupmember     Modify group memberships
net admin           Execute remote command on a remote OS/2 server
net service         List/modify running services
net password        Change user password on target server
...
net help            Print usage information
Valid targets: choose one (none defaults to localhost)
    -S or --server=<server>         server name
    -I or --ipaddress=<ipaddr>      address of target server
    -w or --workgroup=<wg>          target workgroup or domain

Valid miscellaneous options are:
    -p or --port=<port>             connection port on target
    -W or --myworkgroup=<wg>        client workgroup
    -d or --debuglevel=<level>      debug level (0-10)
...