Skip to content

Instantly share code, notes, and snippets.

@opless
Created January 29, 2020 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opless/9b1a13ac3bddf67f34b58c79af4933fd to your computer and use it in GitHub Desktop.
Save opless/9b1a13ac3bddf67f34b58c79af4933fd to your computer and use it in GitHub Desktop.
In /etc/autofs.conf
Change around line 38:
#browse_mode = no
browse_mode = yes
Create /etc/auto.map
nfsexample -rw,soft,intr,rsize=8192,wsize=8192 nfs.server.lan:/nfsshare
oldsmb -fstype=cifs,sec=ntlm,rw,credentials=/etc/creds/old.smb.password,file_mode=0777,dir_mode=0777,noperm ://oldsmb.server.lan/sharename
newsmb -fstype=cifs,rw,credentials=/etc/creds/new.smb.password,file_mode=0777,dir_mode=0777,noperm ://newsmb.server.lan/sharename
nfsexample is an example nfs mount to the export /nfsshare on nfs.server.lan
oldsmb is an example to mount with CIFS/SMB (Windows networking) with NTLM (old style) windows networking shares (SBM2 ?)
newsmb is a more modern example, but using the defaults of your system, see man mount.cifs for more info: (also https://linux.die.net/man/8/mount.cifs )
Make a folder /etc/creds, and sort out permissions
sudo mkdir /etc/creds
sudo chmod 700 /etc/creds
sudo vi /etc/creds/new.smb.password
username=foo
password=bar
sudo chmod 600 /etc/creds/new.smb.password
you get the idea...
Edit /etc/auto.master
around line 8?
/share /etc/auto.map
So now, assuming you have the permissions and files edited correctly, you'll now have a /share folder appear in root
/
+-- share
+-- newsmb
+-- nfsexample
+-- oldsmb
There ought to be a pause when you 'ls /share/newsmb' for the first time,
however that's it mounting the volume on demand with the credentials in /etc/creds
On debian based systems you can just:
apt install autofs cifs-utils nfs-common
you might need other nfs packages like nfs-kernel-server to get nfs portmapper ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment