0

I am executing following steps to mount my server and copy the files. But it interrupts for password. How can I do it automatic ?

sudo apt install cifs-utils 

sudo mount -t cifs -o user=user.name //192.168.X.X/BAfolder  /media

cp -r /media/BAfolder/* /home/techy/Documents/files/
techy
  • 127
  • If it is for the cifs password, there is an option to mount.cifs -credentials=filename, where you may put username, password and windows domain name (see man mount.cifs) – ridgy Dec 23 '16 at 13:30

1 Answers1

1

Save the password in a file with highly restricted permissions in a restricted folder that only you can access. Cat the file out and pipe the output to sudo -S instead of plain sudo.

cat <folder>/file.secret | sudo -S mount -t cifs -o user=user.name //192.168.1.21/BAfolder  /media

store the password in a shell variable export password=X and then echo it

echo $password' | sudo -S mount -t cifs -o user=user.name //192.168.1.21/BAfolder /media
muru
  • 197,895
  • 55
  • 485
  • 740
Kyle H
  • 1,044
  • 6
  • 7
  • hello, I mounted my smbfs witht he above command 'sudo mount -t cifs -o user=user.name //192.168.1.21/BAfolder /media' But it is not executing on other system. I is showing me the options I can do with mount command. like man mount. What can be problem ? – techy Jan 02 '17 at 15:11
  • You run that same command on the other machine? Can you post a pastebin.org link to what you are seeing please? I believe you will want to open another post unless it is related to your original problem too. – Kyle H Jan 02 '17 at 15:14