I'm trying to mount a share and passing credentials through environment variables. This used to work correctly with smbfs root@dev:~# mount.cifs -V mount.cifs version: 1.10-3.0.26a root@vslad-dev:~# uname -a Linux dev 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux root@dev:~# export USER=dummyUser root@dev:~# export PASSWD=pass1 root@dev:~# mkdir /tmp/mountpoint mount --verbose shows that user is set to root whereas I set USER to something different. root@dev:~# mount --verbose -t cifs //10.0.0.2/public /tmp/mountpoint parsing options: rw mount.cifs kernel mount options unc=//10.0.0.2\public,ip=10.0.0.2,user=root,pass=pass1,ver=1,rw mount error 13 = Permission denied Refer to the mount.cifs(8) manual page (e.g.man mount.cifs) PASSWD is correctly picked up though root@dev:~# export PASSWD=pass2 root@dev:~# mount --verbose -t cifs //10.0.0.2/public /tmp/m parsing options: rw mount.cifs kernel mount options unc=//10.0.0.2\public,ip=10.0.0.2,user=root,pass=pass2,ver=1,rw mount error 13 = Permission denied Refer to the mount.cifs(8) manual page (e.g.man mount.cifs) -o user= works as well root@dev:~# mount --verbose -t cifs //10.0.0.2/public /tmp/mountpoint -o user=test parsing options: rw,user=test mount.cifs kernel mount options unc=//10.0.0.2\public,ip=10.0.0.2,pass=pass2,ver=1,rw,user=test mount error 13 = Permission denied Refer to the mount.cifs(8) manual page (e.g.man mount.cifs) root@dev:~# mount --verbose -t cifs //10.0.0.2/public /tmp/mountpoint -o user=test,password=pass3 parsing options: rw,user=test,password=pass3 mount.cifs warning - password specified twice mount.cifs kernel mount options unc=//10.0.0.2\public,ip=10.0.0.2,pass=pass2,ver=1,rw,user=test,password=pass3 mount error 13 = Permission denied Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Created attachment 3776 [details] patch to allow mount.cifs to use USER environment variable
Created attachment 3777 [details] current mount.cifs source code which includes patch To compile this you can do: gcc -o mount.cifs mount.cifs.c and then save the file /sbin/mount.cifs, and put the mount.cifs that you just built in the /sbin directory
Created attachment 3778 [details] minor update
Created attachment 3779 [details] minor update to patch
If it works for you let me know, so I can check it in
It works as expected with the patch.
pushed to Samba git (master branch)