The -S option for sudo makes sudo read the password from stdin instead of prompting. So it would look something like:echo 'password' | sudo -S thecmdAnother option is to modify /etc/sudoers to specify NOPASSWD for certain users. Edit /etc/sudoeres with visudo. Then add the line username ALL=(ALL) NOPASSWD: ALLwhere username is the user to set.
1) Mount the samba share. The command will look something like:sudo mount -t cifs //servername/dir /home/username/mountdir -o password=password user=usernameThe -t option specifies the filesystem (cifs = samba). The servername/dir is the remote directory to mount and the /home/username is the local directory to mount to.Note: smbfs needs to be installed for this to work: sudo apt-get smbfsTo learn more options, read man mount.cifs.2) Copy files.3) Unmount samba share:sudo umount /home/username/mountdir