diff --git a/ConnectingSMBShares.md b/ConnectingSMBShares.md index cdb50f2..c14ef63 100644 --- a/ConnectingSMBShares.md +++ b/ConnectingSMBShares.md @@ -100,3 +100,60 @@ And if we reboot it should show up still. ## Additional Notes For reference Aiden based it off of  [This](https://www.reddit.com/r/SteamDeck/comments/ymjnjy/mounting_smb_shares_with_systemd/) this post, just modified to this situation and me + + +# Automounting using AutoFS and CIFS +You will need the `autofs` and `cifs` packages, and the autofs service will need to be enabled but not running + +Make a credentials file using previous steps. For this example, my credentials are in `/home//.servercreds/-creds` + +AutoFS uses the file `/etc/autofs/auto.master` as its directory master. We can avoid editing this file by putting our directory map files in `/etc/autofs/auto.master.d/`. + +You will need 2 files: a directory map and a file map. +Create the directory map +`/etc/autofs/auto.master.d/.autofs` +and the key file +`/etc/autofs/auto.` + +The directory map can contain multiple maps, however we are going to make one file per map. + +## Indirect Mapping +Indirect mapping allows the user to specify the mount point in the directory map and the subfolder in the key file + +In the directory map we want to list the mount point for thee smb share and it's key file +`/mnt /etc/autofs/auto.` +This tells autofs to mount the share in a subdirectory of /mnt + +In the key file we need to specify the name of the subdirectory, our config options, and thee smb server location +` -fstype=cfs,credentials=/home/**username**/.servercreds/-creds,uid=,gid= :` +as with systemd, replace `uid=,gid=` with your user and group id respectively. +They will probably both be 1000 (so `uid=1000,gid=1000`), but you can check with `id` or `id **username**` +If using an IP address, it needs to be put before `::` + + +## Direct Mapping +Direct mapping requires the user to specify the entire mounting path in the key file + +In the directory map we want to specify we replace the mount point with `/-` to indicate that we are using direct mounting +`/- /etc/autofs/auto.` +This tells autofs to mount the share using the path found in the key file + +In the key file we now need to the entire mounting path rather than just the subdirectoory +`/mnt/ - :` + +## Testing configuration +To test the configuration, without the `autofs` service running, launch `automount` using +`# automount -f -v` +If you configured everytning properly, you will see +`mounted /mnt/` + +Exit `automount` and restart the `autofs` service + +## Additional Notes +Tess based this guide on +https://man.voidlinux.org/auto.master +https://man.voidlinux.org/autofs +/etc/autofs/auto.master +https://computingforgeeks.com/how-to-automatically-mount-nfs-file-system-with-autofs/ + +