Wednesday, November 10, 2010

SMBCLIENT

smbclient -L servername
will show you all available samba / windows shares

To connect to a windows or samba share type

smbclient \\\\servername\\share -U username

you will be asked for your windows password for the username specified

once connected smbclient works like an FTP client

type help for a list of commands.

Keep in mind, you'll need a leading "\" before spaces (ex: My\ Filename.txt).

or alternatively put your filenames in quotes eg "My Filename.txt"

once connected
to copy directories and subdirectories type
recurse

to not be asked (prompted)if you want to replace files. type
prompt

Example:
smbclient '\\server\share'
    mask ""
    recurse ON
    prompt OFF
    cd 'path\to\remote\dir'
    lcd '~/path/to/download/to/'

    mget *

or, all on one line,


smbclient '\\server\share' -N -c 'prompt OFF;recurse ON;cd 'path\to\directory\';lcd '~/path/to/download/to/';mget *'

No comments: