INT 21h

Select language

Автомонтирование SMB (samba) шар через systemd

№ 11820 В разделе Sysadmin от September 22nd, 2022,
В подшивках: ,

Имя файлов юнитов должно совпадать с путем к директории куда должно произойти монтирование.

Юнит самого маунта /etc/systemd/system/mnt-backups-storage.mount

[Unit]
Description=backup storage

[Mount]
What=//backup-server/sql_backup
Where=/mnt/backups/storage
Options=credentials=/root/.smbclient,rw,file_mode=0700,dir_mode=0700,uid=1000
DirectoryMode=0700
Type=cifs

[Install]
WantedBy=multi-user.target

Файл с автомаунтом /etc/systemd/system/mnt-backups-storage.automount

[Unit]
Description=storage automount

[Install]
WantedBy=multi-user.target

[Automount]
Where=/mnt/backups/storage

Файл с авторизацией /root/.smbclient

username=myusername
pass=supapa$$w0rd

Активируем

systemctl enable mnt-backups-storage.mount
systemctl enable mnt-backups-storage.automount
systemctl start mnt-backups-storage.mount

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Облачная платформа
Яндекс.Метрика

Fortune cookie: She was peeved, and called her beau "Mr." Not because, when she came in, he kr., But she knew, just before She opened the door, This same Mr. had kr. sr.