LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2019, 04:57 AM   #1
opafix
LQ Newbie
 
Registered: May 2019
Posts: 1

Rep: Reputation: Disabled
Question Auto-mount a samba share on connection to VPN


How do you automatically mount a network attached drive on connection to a specific network? I am using NetworkManager which automatically connects my laptop to my home VPN when on WiFi but I still have to manually mount my samba shares. They are set up in fstab the usual way such that I can run
Code:
mount /path/to/share/
and it will mount it but I would like to automate this process.

However, I can't simply use fstab auto-mount on boot because I often disconnect and reconnect to different networks and then connect to my VPN after that. It is upon connection to the VPN that I would like to mount the share.
 
Old 05-03-2019, 05:16 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
Welcome to linuxquestions.

A fairly simple solution might be to use autofs or systemd auto mount. The share mounts when you access its mount point and unmounts after an idle timeout.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Mount samba share on Slackware: mount error(6) from mount.cifs frushiyama Slackware 11 01-22-2015 07:12 PM
script to change vpn connection if slow vpn connection andrew44 Linux - General 2 02-23-2014 11:25 AM
VPN server to VPN server IP Address auto route cheesewizz Linux - Networking 0 06-26-2012 07:01 PM
can't mount samba share and then write to the share calbazon Linux - Software 8 10-10-2010 01:35 AM
Auto-mount windows share on boot - manual OK, auto not ok! erskie Linux - Newbie 2 02-12-2008 06:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration