Use systemd to mount CIFS drive: Difference between revisions

From AcrodusWiki
No edit summary
No edit summary
 
Line 21: Line 21:
Where=/mnt/nas
Where=/mnt/nas
[Install]
[Install]
23WantedBy=multi-user.target
WantedBy=multi-user.target
</pre>
</pre>



Latest revision as of 15:24, 23 November 2024

This two examples of unit files that enable a systemd service to mount a cifs drive.

[Unit]
Description=cifs mount script
Requires=network-online.target
After=network-online.service
[Mount]
What=//10.68.64.19/Reports/NMS
Where=/mnt/nas
Options=domain=ewr,username=nms,password=Atkins123!
Type=cifs
[Install]
WantedBy=multi-user.target
[Unit]
Description=Automount NAS
[Automount]
Where=/mnt/nas
[Install]
WantedBy=multi-user.target

Note for Alex.

Make sure the name of the .mount and .automount files are the path of the mount point otherwise it will fail.

Also, use man systemd.mount for more information.