How can I move the files from unix path to windows network shared path and the file should be moved to respective folder in shared path and if not then it is to create a folder based on file name and should move it.

Can you please answer me.Thanks


You could use CIFS for that, which under Debian is known as the cifs-utils package. That way you can mount a samba/cifs share onto your Linux machine and let a script to the rest. A mount would look like:

/sbin/mount -t cifs -o user=<WindowsUser>,password=<WindowsPassword>,uid=<UIDtoOwnFilesOnLinux>,gid=<GIDtoOwnFilesOnLinux> //WindowsMachine/Shared/Folder /mount/point/on/linux

Where especially the password option should be considered twice as this would mean clear text password - without it you should be prompted for <WindowsUser>'s password on WindowsMachine.

Note that you will have to be root to do the mount unless you e.g. add the command to the sudoers file (or preferably to the /etc/sudoers.d directory). This should look like:

#file stored as e.g. /etc/sudoers.d/remoteaccess
linux_user ALL=NOPASSWD: /sbin/mount -t cifs <and so on: command exactly as above!>

And would allow to execute this very command. Make sure to use visudo for changing the file and visudo -c to check your sudoers!


You should install Samba. I believe the command is

sudo apt-get update sudo apt-get install samba

Windows, unfortunately, uses Samba as the network sharing protocol. I've just literally uninstalled Debian from a machine that was using Samba, so I'm sure if you click on the Nautailus file jobby, and select browse network, it will show the share and you can browse to it.

  • Note that especially a cifs mount is of interest, as OP seems to be searching for a shell script method as the tags indicate. Besides that: OP did not mention his UNIX flavour, so I'd be careful talking about apt ... – Fiximan Nov 18 '15 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.