Update ConnectingSMBShares.md
This commit is contained in:
1 parent
0cce1c4c0f
commit
6e9be41cff
1 file changed
+57
@@ -100,3 +100,60 @@ And if we reboot it should show up still.
|
|||||||
|
|
||||||
## Additional Notes
|
## 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
|
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/<username>/.servercreds/<servername>-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/<server-name>.autofs`
|
||||||
|
and the key file
|
||||||
|
`/etc/autofs/auto.<server-name>`
|
||||||
|
|
||||||
|
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.<server-name>`
|
||||||
|
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
|
||||||
|
`<server-name> -fstype=cfs,credentials=/home/**username**/.servercreds/<server-name>-creds,uid=<uid>,gid=<gid> :<server-location>`
|
||||||
|
as with systemd, replace `uid=<uid>,gid=<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 `:<server-location`: `<ip>:<server-location>`
|
||||||
|
|
||||||
|
|
||||||
|
## 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.<server-name>`
|
||||||
|
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/<server-name> -<options> :<server-location>`
|
||||||
|
|
||||||
|
## 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/<server-name>`
|
||||||
|
|
||||||
|
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/
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user