samba command line directory upload

Samba is known for its flexibility, ease of use, and reliability. Traditional means of connecting are via cifs, smb, or map network drive. And it is supported across many operating systems. However, on occasion you may need to upload a directory to a samba server via the command line. One would connect to a samba server using the smbclient command as follows:

smbclient //hostname/data_share -U username

This will get you into the samba server and allow you to interact with a command line interface. You can enter “help” if you want more detailed user information.

To upload a directory on your local machine to the samba server you will need to perform a recursive put. This is because the samba client command line won’t automatically upload subfiles and subdirectories. To upload a folder:

1) Type “recurse”, this will put the client in recursive mode.
2) Type “prompt”, this will toggle off prompting for permssion on whether to upload every subfile and subfolder.
3) Type “mput directory_name”, this will put your local directory up to the samba server.

Be the first to comment

Leave a Reply