Keith via plug on 23 Oct 2020 10:02:55 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux mount of Windows share keeps dropping



On 10/22/20 8:21 PM, Walt Mankowski via plug wrote:
Thanks Joe! I didn't know about either automount or credentials files!
It sounds like it's exactly what I was looking for. I'll give them a
try tomorrow.

Walt

On Thu, Oct 22, 2020 at 07:21:08PM -0400, Joe Rosato via plug wrote:
Put it automount. If a network issue and you use it sparingly, it will
mostly stay unmounted.. and then mount when you use it. Saw this while
waiting in car (parked) so did not read the whole thread, if this was
touched upon. Do a search, you just need to put the login/passwd in a
credentials file.

On Thu, Oct 22, 2020, 5:15 PM Walt Mankowski via plug <
plug@lists.phillylinux.org> wrote:

On Thu, Oct 22, 2020 at 04:55:36PM -0400, Keith via plug wrote:
Ah... ok, the version thing definitely was/is a thing but I haven't had
to
use that trick in at least 10 years.  Structurally speaking what I'm
going
after is a refreshing of stale links.  The network connection is at a
lower
level than the user so, for instance, I use this same technique for
"healing" SIP carrier connections for VoIP servers.  All you are doing is
making sure the connection is available.  Your applications will have no
knowledge of those lower level lower details.  Either apps can access
files
or not so this type of thing is benign (i.e. it fails silently if you are
still connected).  Playing with the version numbers may yield some relief
but typically with that solution it was about forcing the share protocol
down to an earlier version.  1.0 might be too old so you may need to use
something higher.
This morning I tried mounting it with every version listed in the
manpage for mount.cifs. 1.0 is the only one that worked.

Aside from that I'm not sure I understand what it is you're suggesting
I do. Remounting it requires entering both my local password (for
sudo) and my network password, so it would be tricky doing that via
something like cron.

Walt

When remounting you just specify the password on the command line so, for example if you initially did something like this:

mount -t cifs -o user=someguy  //a.b.c.d/someshare /mnt/somemountpoint

the remount command would be:

mount -t cifs -o remount,user=someguy,password=somepassword //a.b.c.d/someshare /mnt/somemountpoint

If your share is mounted, this fails silently.  If not, it will remount.  You can put this in a shell script that executes an infinite loop with an appropriate sleep time.  To protect your password, you should encrypt the file.  You can decrypt and execute it in memory.  This link might be a good start for that:

https://stackoverflow.com/questions/14651616/automatically-decrypt-and-run-an-encrypted-bash-script-without-saving-decrypted


--
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Keith C. Perry, MS E.E.
Managing Member, DAO Technologies LLC
(O) +1.215.525.4165 x2033
(M) +1.215.432.5167
www.daotechnologies.com

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug