fstab doesn't mount active directory shared folder

General support questions
Post Reply
ProdigyLv
Posts: 8
Joined: 2017/09/19 12:42:31

fstab doesn't mount active directory shared folder

Post by ProdigyLv » 2018/09/27 09:47:46

Hi

First of all I am noob in linux.

I have shared folder in active directory. I need CentOS to mount shared folder automatically on boot.
I created line in fstab:

\\192.168.99.99\my_folder /web/my_doc cifs user, uid=0, rw, suid, username=example, password=12345 0 0

After server restart i use command "df" and i see that /web/my_doc is not mounted.
When i use command "mount -a", /web/my_doc mounts perfectly without any problems/errors and I cen list all files in shared folder.
Why fstab doesn't mount \\192.168.99.99\my_folder on boot ?

Soory my eng :D

larwood
Posts: 66
Joined: 2011/07/27 12:07:30
Location: Perth WA, Australia

Re: fstab doesn't mount active directory shared folder

Post by larwood » 2018/09/28 06:16:31

As you are using CentOS7 you should use systemd.

Here are some notes on how I did it. You should name your mount file /etc/systemd/system/web-my_doc.mount and change the other fields to suit your requirements:

Code: Select all

# vim /mnt/cifs/.cifs_creds
	username=user1
	password=secret
# chmod 600 /mnt/cifs/.cifs_creds
# vim /etc/systemd/system/mnt-cifs-logs.mount
	[Unit]
	Requires=network-online.target
	After=network-online.service
	[Mount]
	What=//example.com/logs$
	Where=/mnt/cifs/logs
	Options=credentials=/mnt/cifs/.cifs_creds,workgroup=EXAMPLE,rw
	Type=cifs
	[Install]
	WantedBy=multi-user.target
# systemctl enable mnt-cifs-fortilogs.mount
# systemctl start mnt-cifs-fortilogs.mount

ProdigyLv
Posts: 8
Joined: 2017/09/19 12:42:31

Re: fstab doesn't mount active directory shared folder

Post by ProdigyLv » 2018/09/28 19:23:34

Thank you very much for the information and config sample. Everything works perfectly!

gjaltemba
Posts: 49
Joined: 2016/11/29 15:23:25

Re: fstab doesn't mount active directory shared folder

Post by gjaltemba » 2018/10/03 01:16:19

I switched from my fstab entry with auto-mount but get this error and I have to start service manually.

mount[435] : mount error : could not resolve address for myhostbyname: Unknown error

gjaltemba
Posts: 49
Joined: 2016/11/29 15:23:25

Re: fstab doesn't mount active directory shared folder

Post by gjaltemba » 2018/10/10 03:36:50

This article helped me to configure auto-mount in systemd

https://blog.tomecek.net/post/automount-with-systemd/

Post Reply