Skip to content

Instantly share code, notes, and snippets.

@jonchang
Created January 18, 2024 00:41
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 jonchang/3b12e04d9bebd3f2a2f98397330b5b59 to your computer and use it in GitHub Desktop.
Save jonchang/3b12e04d9bebd3f2a2f98397330b5b59 to your computer and use it in GitHub Desktop.
automount-example
[Unit]
Description=example cifs share automount
[Automount]
Where=/mnt/net/cifs/example
[Install]
WantedBy=multi-user.target
[Unit]
Description=example shared mount
# If fails to start 5 times in 10 minutes disable the mount
StartLimitIntervalSec=600
StartLimitBurst=5
[Mount]
What=//mysmbserver/example
Where=/mnt/net/cifs/example
Type=cifs
Options=rw,file_mode=0770,dir_mode=0770,uid=0,gid=0,username=MY_USERNAME,password=MY_PASSWORD,domainauto,noserverino,vers=2.0
DirectoryMode=0770
[Install]
WantedBy=multi-user.target
#!/bin/sh
# Mounts shared drives on a Linux server.
set -eu
cp mnt-net-cifs-example.mount mnt-net-cifs-example.automount /etc/systemd/system
systemctl daemon-reload
systemctl start mnt-net-cifs-example.automount
systemctl enable mnt-net-cifs-example.automount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment