I mount a network share using cifs which for many years has been done using this command:
sudo mount -t cifs //path-to-network-share -o username=gostal,uid=myUID,gid=myGID
(myUID and myGID are 4-digit numbers) and the share is successfully mounted when password is entered on the command line.
Recently my system admins have done two things:
1 Provided a GIU-activated shell script where the password is entered in the GUI
2 Required a 16-character password containing at least one special character (!"#¤%& …)
1 works by storing the password in a variable which is then referenced in the actual mount command.
2 GUI-activated shell script doesn’t work with the new password.
My new password contains a " which most likely is the reason why the GUI-activated shell script is not happy any more but this is only because the password is stored in a variable. Manually mounting on the command line still works. This means that the shell makes a different interpretation of what is stored in the password variable compared to what is entered on the command line. I can live with that. But here is the irritating thing:
I copied the shell script tied to the GUI like so:
sudo cp /usr/local/bin/mountsmb.sh /usr/local/bin/mountsmb.sh.bak
sudo cp /usr/local/bin/mountsmb.sh /usr/local/bin/mountsmb.sh.mod
I made modifications to the .mod-file and then copied back to mountsmb.sh
The password line is this:
CPASS=$(zenity ${HEADLINE} --password --text "SMB-montering av $2, ange lösenord för Windows") ; CHECKCANCEL
and storing the password in this way does not work so then I put quotation marks around the definition:
CPASS="$(zenity ${HEADLINE} --password --text "SMB-montering av $2, ange lösenord för Windows")" ; CHECKCANCEL
When I tried the GUI after having modified the script it still didn’t work so I thought this modification didn’t do the trick but then I tried running the .mod-file instead and that worked!! Did I forget to copy? No, same mdsum on both mountsmb.sh and mountsmb.sh.mod
This was last Friday the 25th of May. So I think that the shell script once run is cached somewhere so my modification was ignored. Still today there is a difference between the cached file (if caching is what’s going on) and the file on the disk. Sitting in /usr/local/bin today I did:
sudo cat mountsmb.sh
and that gives me the old file but doing instead
sudo cat /usr/local/bin/mountsmb.sh
gives me the modified one. Apparently the file references point to different objects though they really should be the same!
If there is a cache somewhere, how do I flush it? And where is the documentation? This behavior does not really help when trying to isolate problems because the system response is to some other input than what I think I’m giving.