5

I would like to get the current workgroup of my Linux machine. When I google it, I get only methods to set or rename the workgroup. I found a command hostname but that returns only my PC name as username-desktop.

Joker
  • 161

2 Answers2

7

If you are looking for the Windows Workgroup that your computer is, you might have success with smbclient -L localhost -N.

On the last line of the output this gives the workgroup name and the name of the workgroup's master (a Linux system using Samba system in my case):

    Workgroup            Master
    ---------            -------
    WORKGROUP            OWL
Anthon
  • 79,293
  • I am new to Linux. Linux systems have a workgroup like Windows systems do right? I want to get that name. Will the samba client be installed in every Linux system by default? – Joker May 06 '14 at 07:58
  • 1
    @Parthe No, the workgroup is a Windows artifact. In my case I allow windows machines to access my Linux server system using the SMB/CIFS protocol, implemented by the optional Samba software (optional on Linux). – Anthon May 06 '14 at 08:40
  • Thanks for your reply. So there is no guarantee that Samba will be installed in every Linux machine. Workgroups don't exist in Linux. Am I right? I will try and let you know if the above command worked. – Joker May 06 '14 at 09:29
  • @Parthe That is correct, there is no guarantee it is installed. – Anthon May 06 '14 at 10:33
0

I don't know why, but my Unraid server returns with smbclient this error message (although SMB1 is enabled and a workgroup is set):

SMB1 disabled -- no workgroup available

Because of that I came up with reading the workgroup value of smb.conf as follows

testparm -sl --parameter-name=workgroup 2>/dev/null

returns:

WORKGROUP

Used options:

-s, --suppress-prompt           Suppress prompt for enter
-l, --skip-logic-checks         Skip the global checks
    --parameter-name=STRING     Limit testparm to a named parameter
mgutt
  • 467