Once Samba is configured and the service is running properly, there is very little you need to do to keep it going. However, Samba can provide you with a great deal of useful information about user behavior on your network. If you want to check out what's going on with Samba from your local system, there are a few different tools you can use. Some tools let you see how others are using the shared files and printers from your Linux system, while others let you view and access files and printers being shared by other computers.
To see the users who are currently connected to the Samba server and what they are doing, issue the following command:
# smbstatus Samba version 3.0.2-7.FC1 PID Username Group Machine --------------------------------------------------------- Service pid machine Connected at ------------------------------------------------------------- Musicbox 9399 maple Thu Jan 29 00:30:21 2004 IPC$ 9399 maple Wed Jan 28 20:05:10 2004
If you can't remember the IP address of a computer attached to your network, but you do remember the machine name, use the Samba net command to get the IP number:
# net lookup host1 10.0.0.1
Use the smbclient command to see the status of shares from other computers on your network. smbclient will report all shared directories and printers, including those attached to Windows or Linux client machines. Here is a sample output from the smbclient command:
# smbclient -L fileserver Sharename Type Comment --------- ---- ------- homes Disk Musicbox Disk My music collection IPC$ IPC IPC Service (Toys samba server) ADMIN$ IPC IPC Service (Toys samba server) lp0 Printer Created by redhat-config-printer Chris Disk Home directory of chris Server Comment --------- ------- Workgroup Master --------- ------ CSTREET DUCK
The output shows that shared directories include homes, Musicbox, and chris. The printer lp0 is also being shared. The master browser for the CSTREET workgroup is DUCK.
If you like, you can actually connect to and work with the share from Linux using the smbclient command. Using the example above, assume that you want to connect to the Musicbox share. The following example shows a session started to a share using the smbclient command:
# smbclient \\\\ fileserver \\ Musicbox passW3d smb: \> help ? altname archive blocksize cancel cd chmod chown del dir du exit get help history lcd link lowercase ls mask md mget mkdir more mput newer open print printmode prompt put pwd q queue quit rd recurse reget rename reput rm rmdir setmode symlink tar tarmode translate ! smb: \ > cd Bob smb: \ Bob \ > ls . D 0 Mon Feb 2 13:16:44 2004 .. D 0 Mon Feb 2 12:13:18 2004 01-Tangled_Up_In_Blue.ogg 7867809 Mon Feb 2 12:11:07 2004 02-Simple_Twist_Of_Fate.ogg 6344707 Mon Feb 2 12:11:13 2004 03-You_re_A_Big_Girl_Now.ogg 6421634 Mon Feb 2 12:11:19 2004 62014 blocks of size 524288. 44544 blocks available smb: \ Bob \> quit
You can put the password on the smbclient command line, as shown in the first line of the code block by the passW3d element, or be prompted for it. However, if you type the password on the command line, it can be retrieved through the .bash_history file. It's better to use the prompt. Type help to see available commands. Once connected, you can use smbclient like an FTP interface. Use cd to change directories, ls to list, and get, mget, put, and mput to get and put files. Type quit when you are done.