List a Machine s Samba Shares


List a Machine's Samba Shares

smbclient

So you know that a machine has Samba shares on it, thanks to the commands outlined in the previous section, but you don't know what those shares are. The smbclient command is a versatile tool that can be used to connect to shares and work with them; at a more simple level, however, it can also list the shares available on a computer. Just use the -L (or --list) option, followed by the NetBIOS name or IP address. When prompted for a password, simply press Enter.

$ smbclient -L ELIOT Password: Anonymous login successful Domain=[TURING] OS=[Unix] Server=[Samba 3.0.14a-Ubuntu] Sharename Type Comment print$    Disk Printer Drivers documents Disk Shared presentations and other files IPC$       IPC  IPC Service (eliot server (Samba,   Ubuntu)) ADMIN$     IPC  IPC Service (eliot server (Samba,   Ubuntu)) Anonymous login successful Domain=[TURING] OS=[Unix] Server=[Samba 3.0.14a- Ubuntu] 


In this case, you can see all of the shares that are available either to an anonymous logon or have been marked as being able to be browsed in the server's smb.conf file. To see the shares available to you if you were to log on, add the -U (or --user) option, followed by your Samba username as found on the Samba server.

Note

Your Samba username might or might not be the same as your Linux (or Windows or Mac OS X) username on the Samba server. You need to look on the Samba server to make sure.


$ smbclient -L ELIOT -U scott Password: Domain=[ELIOT] OS=[Unix] Server=[Samba 3.0.14a- Ubuntu] Sharename Type Comment print$    Disk Printer Drivers documents Disk Shared presentations and other files IPC$       IPC  IPC Service (eliot server (Samba,   Ubuntu)) ADMIN$     IPC  IPC Service (eliot server (Samba,   Ubuntu)) scott     Disk Home Directories Domain=[ELIOT] OS=[Unix] Server=[Samba 3.0.14a-  Ubuntu] 


When you log in, you now see a new share, scottthe home directory of this user. This also tells you that you can log in, which brings you to the next section, in which you log in and actually use the stuff you find on the share.

Tip

If you want to test the shares you just created on a Samba server, an excellent method is to open a shell on that box, and then enter the following:

$ smbclient -L localhost 


When prompted for a password, press Enter. This way you can quickly see if the new share you added is available. Of course, if you didn't make the share open to browsing, you'll need to log on as a user who can view that share using the -U option.




Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net