Samba Basic - Lesson 1: Samba Simply

  12 years ago


I am creating this Tutorial as I start a new journey into learning more about Samba in Linux environment. Hopefully it would be useful for us as a simple guide :).


  1. LinuxMint11 64bit  with Samba 3.5.8
  2. ASUS RT-N16 router running TomatoUSB with Samba 3.0.37

1. Checking SAMBA running on local Subnet:

$ findsmb

--> This will list a table:  IpAddr; Netbios Name; Workgroup; OS; Version

---------------------------------------------------------------------   MINT11        +[MYHOME] [Unix] [Samba 3.5.8]   ROUTER        *[MYHOME] [Unix] [Samba 3.0.37]


Note: I have doctored the actual IPaddr and Name.

2. Changing the Workgroup - Joining another workgroup (Inter-operate with Windows)

To change the LinuxMint workgroup, we need to edit the [/etc/samba/smb.conf] file:

$ sudo gedit /etc/samba/smb.conf

Look for:

workgroup = WORKGROUP

and change to:

workgroup = MYHOME

--> change MYHOME to your desired workgroup name.

3. Checking available domains and workgroups visible on the current network.

$ net rap domain
Enter user's password:

Enumerating domains:

    Domain name          Server name of Browse Master
    -------------        ----------------------------
    MYHOME               ROUTER
    WORKGROUP            MINT11

--> Observation: Might need a restart: WORKGROUP name has not been changed. Quick check with Vista, WinXp and Win98 Guest OSes in Virtualbox also show the same observation.

A reboot fixed the issue and only MYHOME    ROUTER line appears. Vista Network Neighbourhood detected the change almost immediately but WinXp and Win98 took awhile to update. However, all was as expected.

---> Update: 20111106 >> Well, we may also restart the samba services and wait for a couple of minutes for the changes to take effect.

$ sudo service smbd restart
$ sudo service nmbd restart

Note: Please wait a couple of minutes for the changes to take effect before checking.  Alternatively, you could try checking it immediately and a few minutes later again to experience the time lag.

4. Checking servers in this domain or workgroup.

$ net rap server domain
Enter user's password:

Enumerating servers in this domain or workgroup:

    Server name          Server description
    -------------        ----------------------------
    MINT11               MINT11 server (Samba, LinuxMint)
    ROUTER               RTN16

--> Update: 20111106-1 >> Well, another observation regarding the 'findsmb' command: it only list out samba and win98 systems on the local subnet. It didnot show my WinXP and Vista though.

$ findsmb

---------------------------------------------------------------------   MINT11          [MYHOME] [Unix] [Samba 3.5.8]   WIN98            [    MYHOME      ]   MINT11B         [MYHOME] [Unix] [Samba 3.5.8]   MINT11B         [MYHOME] [Unix] [Samba 3.5.8]   ROUTER        *[MYHOME] [Unix] [Samba 3.0.37]

Note: Not too sure why MINT11B was listed twice here. Yes, LinuxMint for my children too.

5. Exposing Network Shares, including non Linux Samba share: checking on Windows share.

$ smbtree
Enter user's password:
    \\WIN98                    Win98
Server requested LANMAN password (share-level security) but 'client lanman auth' is disabled
failed tcon_X with NT_STATUS_ACCESS_DENIED
    \\ROUTER                 RTN16
        \\ROUTER\IPC$               IPC Service (RTN16)
        \\ROUTER\jffs               JFFS
        \\ROUTER\Data               Data
        \\WINXPP\C$                 Default share
        \\WINXPP\ADMIN$             Remote Admin
        \\WINXPP\IPC$               Remote IPC
    \\MINT11B                 MINT11B server (Samba, LinuxMint)
        \\MINT11B\IPC$               IPC Service (MINT11B server (Samba, LinuxMint))
        \\MINT11B\Public             Public share for All
        \\MINT11B\print$             Printer Drivers
    \\MINT11                  MINT11 server (Samba, LinuxMint)
        \\MINT11\Print_to_PDF       Print to a PDF File
        \\MINT11\IPC$               IPC Service (MINT11 server (Samba, LinuxMint))
        \\MINT11\print$             Printer Drivers
        \\VISTA\IPC$               Remote IPC
        \\VISTA\C$                 Default share
        \\VISTA\ADMIN$             Remote Admin

Note: MYHOME is the workgroup name. I have the same User and Password created on all the systems except Win98 which was using 'share-level' security instead of user-level. As such, the shares in the \\WIN98 system was throwing an error as shown above. NOT TOO SURE how Windows Administrators would feel about Samba exposing the C$ share in this command for all Linux's users to 'exploit': Those xyz$ shares are supposed to be hidden for administrative uses only.

That's all for now. Will update this with more as I progress.

vampyren 4 years ago

sadly the "sudo service smbd restart" dont work in 19.2
==>Failed to restart smbd.service: Unit smbd.service not found.

Although i see that even without restarting the change took affect after a minute or two.

guruwannabe 12 years ago

I used the GUI in both Linux and Windows to create new users.

Padre_King 12 years ago

What are the commands to create smb users?

guruwannabe 12 years ago

Hi blueXrider,
Thanks for pointing that out.

blueXrider 12 years ago

As a note sudo gedit /etc/samba/smb.conf

If you edit this file then the NETBIOS and WORKGROUP "NAME" needs to be CAPITALIZED. I have seen issues with the file when it isn't done this way.