Common Samba Commands

Some key commands associated with Samba are listed in Table 16-4. This table does not include commands that require extensive knowledge of Microsoft systems such as NT quotas or access control lists.

Here are some examples of the use of some of these commands. The smbtree command, as shown in Figure 16-1, illustrates shared directories and printers from other Samba servers on a network. Note how it lists systems on workgroups (or domains) named WORKGROUP and MSHOME. The -U michael option adds shares available to the user michael, such as his home directory.

If you'd rather browse Samba shares on a specific system, the smbclient command can help. For example, the smbclient -L //hostname command reviews shared directories and printers from the Samba server on the computer named hostname. As with the smbtree command, Samba shares accessible to a specific user can be viewed with the -U username option. For example, if the [homes] share is activated in the Samba server

Samba Command

Description

findsmb

Lists systems that respond to SMB name queries (and are thus Samba servers that might have shared directories or printers).

mount.cifs

Mounts shared Samba directories; as the SUID bit is enabled, can be run by regular users. Successor to the smbmount command.

net

Supports access similar to the Microsoft NET command.

nmblookup

Broadcasts a lookup request to a Samba/CIFS server.

pdbedit

Manages user accounts in a Security Accounts Manager (SAM) database.

smbclient

Lists shares in a specified Samba server; can be used as an FTP-style client on a Samba server.

smbcontrol

Sends messages to Samba servers.

smbpasswd

Creates a Microsoft network password for a given user.

smbstatus

Displays the status of current connections from a Samba server.

smbtree

Lists the shared directories from all connected Samba servers.

tdbbackup

Backs up Samba databases in the /var/lib/samba directory.

umount.cifs

Unmounts shared Samba directories; as the SUID bit is enabled, can be run by regular users. Successor to the smbumount command.

Table 16-4. Selected Samba Commands

configuration file, the following command would reveal the home directory of the given user as a shared directory:

$ smbclient -L //hostname -U username

Once a Microsoft network shared directory is configured on a remote system (even from a Samba server), you can mount it from a Linux client with the mount.cifs command. For example, if the share name from the computer named sambahost is [backups] as defined in the Samba configuration file, the directory can be mounted on the local /mnt directory with the following command:

$ mount.cifs //sambahost/backups /mnt ubuntuhardyserver server (Samba, Ubuntu)

IPC Service (ubuntuhardyserver server (Samba.

[email protected]:-"S smbtree -U michael Password: WORKGROUP

\\UBUNTUHAHDYS ER V

\ \UBUNTUHARDYS ERV\IPC S

\\UBUNTUHARDYSERV\print S Printer Drivers

WUBUNTUHARDY3 ubuntuhardy3 server (Samba, Ubuntu)

\\UEUNTUEAHDY3\PDF PDF

WUäüNi'UtiAKUY¿\printS Printer unvers

WUBUNTUHARDY3\IPCS IPC Sei vlue (uixniLuIiai dy 3 scj vci (Samba, UbunLu) )

MSHOME

WUBUNTUS ERVER ubuntuserver server (Samba, Ubuntu)

Home Directories Second copy

No In formt i on Available No Information AvaiLabie s f adj ; Ik Pi InLej Di ivei i Donna's Backup

IPC Service (ubuntuserver server (Samba, Ubuntu))

\ \UBUNTUS ERVER \michael WUBUNTUS ERVER \ Another Laser \\UBUNTUSERVER\LaserJet-4L \ \UBUNTUS ERVER \UbuntuPr int er \ \UäUNiTJ üUkv üh \i' lr st L'las s WUBUNTUSEEVER \pi lutS WUBUNTUSERVER Wnt \\UBUOTUSERVER\IPCS WUBUNTUGG UbuntuGG server (Samba, Ubuntu)

WUBUNTUGG\SambaDesktop Connected to the Desktop

WUBUNTUGG \ AnotherLaser Second copy

WUBUNTUGG\FirstClass sfadj;lk

\\UäUNruüü\LaserJet-4L No information Available

WUBUNTUGG\PSC_1Z10 PSC_1Z10

WUBUNTUGG\IPCS IPC Scrvicc (UbuntuGG server {Samba, Ubuntu))

WUBUNTUGG \,tmp Temporary Files

WUBUNTUGG\prints Printer Drivers [email protected]:-S |

[email protected]:-S |

This command does not require administrative privileges, courtesy of the SUID bit associated with the mount.cifs command. This can be confirmed with the ls -l /sbin/ mount.cifs command.

0 0

Post a comment