I have Ubuntu 16.04 LTS server with configured public share on it.
My /etc/samba/smb.conf is below
[public_share]
comment = Ubuntu Public Share
path = /srv/samba/public_share
guest ok = yes
read only = no
For some reasons I need to mount this share on boot to /media/public_share. So I added it to the /etc/fstab:
# <file system> <mount point> <type> <options> <dump> <pass>
//localhost/public_share /media/public_share/ cifs guest,noperm 0 2
But it does not get mounted on boot. It mounts only manually with sudo mount -a
after login.
Adding it to /etc/rc.local such as
mount -t cifs //localhost/public_share /media/public_share/ -o guest,noperm
does not help too.
What am I doing wrong?
How I can auto-mount //localhost/public_share to /media/public_share/ during boot?
Do I need special systemd configuration or something special?
Update 1: For localhost server name I have the following log:
$ systemctl status media-public_share.mount
● media-public_share.mount - /media/public_share
Loaded: loaded (/etc/fstab; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Вт 2017-12-19 22:15:05 MSK; 16min ago
Where: /media/public_share
What: //localhost/public_share
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 1461 ExecMount=/bin/mount //localhost/public_share /media/public_share -t cifs -o guest,noperm (code=exited, status=32)
дек 19 22:15:05 hostname systemd[1]: Mounting /media/public_share...
дек 19 22:15:05 hostname mount[1461]: Unable to find suitable address.
дек 19 22:15:05 hostname systemd[1]: media-public_share.mount: Mount process exited, code=exited status=32
дек 19 22:15:05 hostname systemd[1]: Failed to mount /media/public_share.
дек 19 22:15:05 hostname systemd[1]: media-public_share.mount: Unit entered failed state.
Changing address to 127.0.0.1, or setting 127.0.0.1 with options username=guest,password=,noperm
do not remove "Unable to find suitable address" message.
I moved update 2 and update 3 to answer.
/etc/network/if-up.d
. It just works.x-systemd.automount,noauto
to /etc/fstab helps without hacks.