Previous Section  < Day Day Up >  Next Section

Recipe 23.20. Connecting Linux Clients to a Samba Domain with Command-Line Tools

23.20.1 Problem

You need to connect to a Samba domain—how do you send Samba your login and password with smbtree, smbclient, and smbmount?

23.20.2 Solution

You can send the username and password of any Samba user with these commands. So you can view your homes share with smbtree, for example, even though it is not browseable, and then connect with smbclient:

$ smbtree -U andrew

added interface ip=192.168.1.5 bcast=192.168.1.255 nmask=255.255.255.0

Password:

Got a positive name query response from 192.168.1.5 ( 192.168.1.5 )

Got a positive name query response from 192.168.1.5 ( 192.168.1.5 )

Got a positive name query response from 192.168.1.5 ( 192.168.1.5 )

HOLSTEIN

Got a positive name query response from 192.168.1.5 ( 192.168.1.5 )

        \\WINDBAG                       Samba PDC

                \\WINDBAG\andrew                User's Home Directories

                \\WINDBAG\ADMIN$                IPC Service (Samba PDC)

                \\WINDBAG\IPC$                  IPC Service (Samba PDC)

$ smbclient //windbag/andrew  -U andrew

Password:

Domain=[HOLSTEIN] OS=[Unix] Server=[Samba 3.0.5-Debian]

smb: \>

Or, instead of using smbclient, you can mount the share with smbmount:

$ smbmount //windbag/andrew  samba -o andrew

added interface ip=192.168.1.5 bcast=192.168.1.255 nmask=255.255.255.0

Password:

To unmount it when you're finished, use:

$ smbumount  samba

23.20.3 Discussion

You may also put your password on the command line, after your username, but that exposes it to any snoopy eyeballs:

$ smbmount //windbag/andrew samba -o andrew bigsecret

23.20.4 See Also

  • smbmount(8), smbumount(8), smbtree(1)

    Previous Section  < Day Day Up >  Next Section