s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
8. Accessing an SMB Share With Linux MachinesLinux (UNIX) machines can also browse and mount SMB shares. Note that this can be done whether the server is a Windows machine or a Samba server! An SMB client program for UNIX machines is included with the Samba distribution. It provides an ftp-like interface on the command line. You can use this utility to transfer files between a Windows 'server' and a Linux client. Most Linux distributions also now include the useful smbfs package, which allows one to mount and umount SMB shares. More on smbfs below. To see which shares are available on a given host, run:
/usr/bin/smbclient -L host where 'host' is the name of the machine that you wish to view. this will return a list of 'service' names - that is, names of drives or printers that it can share with you. Unless the SMB server has no security configured, it will ask you for a password. Get it the password for the 'guest' account or for your personal account on that machine. For example:
smbclient -L zimmerman The output of this command should look something like this:
The browse list shows other SMB servers with resources to share on the network. To use the client, run:
/usr/bin/smbclient service <password> where 'service' is a machine and share name. For example, if you are trying to reach a directory that has been shared as 'public' on a machine called zimmerman, the service would be called \\zimmerman\public. However, due to shell restrictions, you will need to escape the backslashes, so you end up with something like this:
/usr/bin/smbclient \\\\zimmerman\\public mypasswd where 'mypasswd' is the literal string of your password. You will get the smbclient prompt:
Type 'h' to get help using smbclient:
If you can use ftp, you shouldn't need the man pages for smbclient. Although you can use smbclient for testing, you will soon tire of it for real work. For that you will probably want to use the smbfs package. Smbfs comes with two simple utilties, smbmount and smbumount. They work just like mount and umount for SMB shares. One important thing to note: You must have smbfs support compiled into your kernel to use these utilities! The following shows a typical use of smbmount to mount an SMB share called "customers" from a machine called "samba1":
Issuing a mount command will now show the share mounted, just as if it were an NFS export:
Please see the manual pages for smbmount and smbumount for details on the above operation.
Next Previous Contents |