Use systemd to mount CIFS drive: Difference between revisions

From AcrodusWiki
(Created page with "This two examples of unit files that enable a systemd service to mount a cifs drive. <pre> [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 </pre> <pre> [Unit] Description=Automount NAS [Automount] Where=/mnt/nas [Install] 23WantedBy=multi-user.target </pre>")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 21: Line 21:
Where=/mnt/nas
Where=/mnt/nas
[Install]
[Install]
23WantedBy=multi-user.target
WantedBy=multi-user.target
</pre>
</pre>
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.

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.