You are not logged in.
Hi, I have been trying to use FSTAB over the years to connect to windows shares successfully but I could not fix an issue about system waiting for umount at shutdown or reboot. So looked into the alternative option of systemd. I followed the wiki but have two issues, failed to mount at boot and if I manually mount it by starting it, it shows success but I am only getting read only.
I am using a credentials file with username and password that is the same I used when using fstab.
my systemd file is named and located at and my file contains the following
/etc/systemd/system/home-au009900-my_data.mount
[Unit]
Description=Mount Share at boot
Requires=NetworkManager.service
After=network-online.target
Wants=network-online.target
[Mount]
What=//192.168.0.100/my_data
Where=/home/au009900/my_data
Options=credentials=/home/au009900/credentials,vers=2.0,users,iochars$
Type=cifs
TimeoutSec=30
[Install]
WantedBy=multi-user.targetIf I check the status I see
● home-au009900-my_data.mount - Mount Share at boot
Loaded: loaded (/etc/systemd/system/home-au009900-my_data.mount; en
Active: active (mounted) since Sun 2017-12-17 21:59:00 AEDT; 35min
Where: /home/au009900/my_data
What: //192.168.0.100/my_data
Process: 711 ExecMount=/usr/bin/mount //192.168.0.100/my_data /home/
Tasks: 0 (limit: 4915)
CGroup: /system.slice/home-au009900-my_data.mount
Dec 17 21:59:00 testlx301 systemd[1]: Mounting Mount Share at boot...
Dec 17 21:59:00 testlx301 systemd[1]: Mounted Mount Share at boot.When I browse the share I am only getting read access.
Offline
Hi, already tried with rw mount option?
Options=credentials=/home/au009900/credentials,vers=2.0,users,rw,iochars$Offline
Hi sorry yes the line was truncated in the original post, here is is in full
Options=credentials=/home/au009900/credentials,vers=2.0,users,iocharset=utf8,rw,x-systemd.automountbasically did not change much except added the SMB version, as it was missing at first. Adding it did not make any difference.
Offline
Maybe the directory permissions aren't properly applied, who owns the files on the share? What if you explicitly pass the UID/GID of the user supposed to have access?
Offline
Hi, I am using the credentials of the admin account on the windows share.
If I remove the credentials option and instead hard code the username and password I get the same read only mount for the user.
But if I elevate my privalages to SU and browse the mounted share, I can read and write.
I had thought that mapping the mount point in my home profile and using the option "users" then allow any account to access the share with the correct rights.
[Unit]
Description=Mount Share at boot
Requires=NetworkManager.service
After=network-online.target
Wants=network-online.target
[Mount]
What=//192.168.0.100/my_data
Where=/home/au009900/my_data
Options=username=admin,password=thepassword,user,vers=2.0,iocharset=utf8,rw,x-systemd.automount
Type=cifs
TimeoutSec=30
[Install]
WantedBy=multi-user.targetI will now put the credentials file back in.
Offline
as a test I disabled the systemd
sudo systemctl disable home-au009900-my_data.mountthen edited my fstab folder to include the line
//192.168.0.100/my_data /home/au009900/my_data cifs credentials=/home/au009900/credentials,user,vers=2.0 0 0rebooted, logged in user and opened file manager and opened the drive, with read and write, so it works with fstab, but I want to try and get systemd to work as I have read this is now a better option especially I have problems restarting my PC with fstab and it not succesfully unmounting and having to wait 1.5 minutes. Sounds minor but annoys me alot.
I then commented out the fstab line to prevent it from running, rebooted.
So reading the man pages it states that it defaults to DirectoryOption=0755, so I edited the .mount to now be
[Unit]
Description=Mount Share at boot
Requires=NetworkManager.service
After=network-online.target
Wants=network-online.target
[Mount]
What=//192.168.0.100/my_data
Where=/home/au009900/my_data
Options=credentials=/home/au009900/credentials,vers=2.0,iocharset=utf8,rw,x-systemd.automount
DirectoryMode=0770
Type=cifs
TimeoutSec=30
[Install]
WantedBy=multi-user.targetAlas still read only see mount output this after a reboot.
//192.168.0.100/my_data on /home/au009900/my_data type cifs (rw,relatime,vers=2.0,cache=strict,username=admin,domain=,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.0.100,
file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=65536,wsize=65536,echo_interval=60,actimeo=1,x-systemd.automount)and systemctl status
● home-au009900-my_data.mount - Mount Share at boot
Loaded: loaded (/etc/systemd/system/home-au009900-my_data.mount; enabled; vendor preset: disabled)
Active: active (mounted) since Sat 2017-12-23 15:04:27 AEDT; 2min 27s ago
Where: /home/au009900/my_data
What: //192.168.0.100/my_data
Process: 718 ExecUnmount=/usr/bin/umount /home/au009900/my_data -c (code=exited, status=0/SUCCESS)
Process: 834 ExecMount=/usr/bin/mount //192.168.0.100/my_data /home/au009900/my_data -t cifs -o credentials=/home/au009900/credentials,vers=
Tasks: 0 (limit: 4915)
CGroup: /system.slice/home-au009900-my_data.mount
Dec 23 15:04:27 testlx301 systemd[1]: Mounting Mount Share at boot...
Dec 23 15:04:27 testlx301 systemd[1]: Mounted Mount Share at boot. Last edited by exup (2017-12-23 04:12:02)
Offline
I am not talking about your credentials, pass UID=au009900 ,GID=au009900 (or users or whatever the default group for your user is) additionally to your mount options. The systemd service instance runs as root, and without explicitly passing the UID and GID you wish to control the mountpoint with, it will default to using root, which your normal user has no write access to. Option "users" only allows your normal user to pass the share to a normal mount call,, however since you are mounting the share as root, the permissions are set for that.
Last edited by V1del (2017-12-23 11:59:32)
Offline
OK great advice.
so added the uid and gid for my id and it works I have read and write access.
But problem still outstanding is its not connecting at restart. I have to run systemctl start from command line. after I log in, I suspect its due to no network even though I have enabled NetworkManager-wait-online. (or should I be using systemd.network-wait-online)
here is the journal
Dec 24 23:19:44 testlx301 NetworkManager[338]: <info> [1514117984.9824] manager: startup complete
Dec 24 23:19:44 testlx301 systemd[1]: Started Network Manager Wait Online.
Dec 24 23:19:44 testlx301 systemd[1]: Reached target Network is Online.
Dec 24 23:19:44 testlx301 systemd[1]: Mounting Mount Share at boot...
Dec 24 23:19:45 testlx301 kernel: FS-Cache: Loaded
Dec 24 23:19:45 testlx301 kernel: Key type dns_resolver registered
Dec 24 23:19:45 testlx301 kernel: FS-Cache: Netfs 'cifs' registered for caching
Dec 24 23:19:45 testlx301 kernel: Key type cifs.spnego registered
Dec 24 23:19:45 testlx301 kernel: Key type cifs.idmap registered
Dec 24 23:19:45 testlx301 kernel: CIFS VFS: Error connecting to socket. Aborting operation.
Dec 24 23:19:45 testlx301 kernel: CIFS VFS: cifs_mount failed w/return code = -101
Dec 24 23:19:45 testlx301 systemd[1]: home-au009900-my_data.mount: Mount process exited, code=exited s
Dec 24 23:19:45 testlx301 systemd[1]: home-au009900-my_data.mount: Failed with result 'exit-code'.
Dec 24 23:19:45 testlx301 systemd[1]: Failed to mount Mount Share at boot.
Dec 24 23:19:45 testlx301 systemd[1]: Reached target Multi-User System.
Dec 24 23:19:45 testlx301 systemd[1]: Reached target Graphical Interface.
Dec 24 23:19:45 testlx301 systemd[1]: Startup finished in 2.215s (kernel) + 11.044s (userspace) = 13.2
Dec 24 23:19:47 testlx301 sddm-greeter[419]: Reading from "/usr/share/xsessions/xfce.desktop"
Dec 24 23:19:47 testlx301 sddm[377]: Message received from greeter: Loginip address is not picked up until logging into the desktop, I am using wifi, so how to delay till after a connection is made?
Offline
I did disable NetworkManager-wait-online and enabled systemd-networkd-wait-online and it seemed to delay the timing of connection in the journal till after I logged in but I think its just before its fully connected, see below journal
Dec 24 23:40:00 testlx301 NetworkManager[339]: <info> [1514119200.5055] device (wls1): supplicant interface state: associated -> completed
Dec 24 23:40:00 testlx301 NetworkManager[339]: <info> [1514119200.5055] device (wls1): Activation: (wifi) Stage 2 of 5 (Device Configure) su
Dec 24 23:40:00 testlx301 NetworkManager[339]: <info> [1514119200.5062] device (wls1): state change: config -> ip-config (reason 'none', sys
Dec 24 23:40:00 testlx301 NetworkManager[339]: <info> [1514119200.5071] dhcp4 (wls1): activation: beginning transaction (timeout in 45 secon
Dec 24 23:40:00 testlx301 systemd-networkd-wait-online[239]: ignoring: lo
Dec 24 23:40:00 testlx301 dbus-daemon[334]: [system] Successfully activated service 'org.freedesktop.UPower'
Dec 24 23:40:00 testlx301 systemd[1]: Started Daemon for power management.
Dec 24 23:40:00 testlx301 pkexec[624]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
Dec 24 23:40:00 testlx301 pkexec[624]: au009900: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/bin/xfpm-power-backlight-h
Dec 24 23:40:00 testlx301 wpa_supplicant[394]: wls1: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-43 noise=9999 txrate=1000
Dec 24 23:40:01 testlx301 systemd-networkd[238]: wls1: Gained IPv6LL
Dec 24 23:40:01 testlx301 systemd-networkd-wait-online[239]: ignoring: lo
Dec 24 23:40:01 testlx301 systemd[1]: Started Wait for Network to be Configured.
Dec 24 23:40:01 testlx301 systemd[1]: Reached target Network is Online.
Dec 24 23:40:01 testlx301 systemd[1]: Mounting Mount Share at boot...
Dec 24 23:40:01 testlx301 kernel: FS-Cache: Loaded
Dec 24 23:40:01 testlx301 kernel: Key type dns_resolver registered
Dec 24 23:40:01 testlx301 kernel: FS-Cache: Netfs 'cifs' registered for caching
Dec 24 23:40:01 testlx301 kernel: Key type cifs.spnego registered
Dec 24 23:40:01 testlx301 kernel: Key type cifs.idmap registered
Dec 24 23:40:01 testlx301 systemd[1]: home-au009900-my_data.mount: Mount process exited, code=exited status=32
Dec 24 23:40:01 testlx301 systemd[1]: home-au009900-my_data.mount: Failed with result 'exit-code'.
Dec 24 23:40:01 testlx301 kernel: CIFS VFS: Error connecting to socket. Aborting operation.
Dec 24 23:40:01 testlx301 kernel: CIFS VFS: cifs_mount failed w/return code = -101
Dec 24 23:40:01 testlx301 systemd[1]: Failed to mount Mount Share at boot.
Dec 24 23:40:01 testlx301 systemd[1]: Reached target Multi-User System.
Dec 24 23:40:01 testlx301 systemd[1]: Reached target Graphical Interface.
Dec 24 23:40:01 testlx301 systemd[1]: Startup finished in 2.201s (kernel) + 18.846s (userspace) = 21.047s.
Dec 24 23:40:02 testlx301 NetworkManager[339]: <info> [1514119202.4864] dhcp4 (wls1): address 192.168.0.231
Dec 24 23:40:02 testlx301 NetworkManager[339]: <info> [1514119202.4865] dhcp4 (wls1): plen 24
Dec 24 23:40:02 testlx301 NetworkManager[339]: <info> [1514119202.4866] dhcp4 (wls1): expires in 3600 seconds
Dec 24 23:40:01 testlx301 systemd-networkd-wait-online[239]: ignoring: lo
Dec 24 23:40:01 testlx301 systemd[1]: Started Wait for Network to be Configured.
Dec 24 23:40:01 testlx301 systemd[1]: Reached target Network is Online.
Dec 24 23:40:01 testlx301 systemd[1]: Mounting Mount Share at boot...
Dec 24 23:40:01 testlx301 kernel: FS-Cache: Loaded
Dec 24 23:40:01 testlx301 kernel: Key type dns_resolver registered
Dec 24 23:40:01 testlx301 kernel: FS-Cache: Netfs 'cifs' registered for caching
Dec 24 23:40:01 testlx301 kernel: Key type cifs.spnego registered
Dec 24 23:40:01 testlx301 kernel: Key type cifs.idmap registered
Dec 24 23:40:01 testlx301 systemd[1]: home-au009900-my_data.mount: Mount process exited, code=exited status=32
Dec 24 23:40:01 testlx301 systemd[1]: home-au009900-my_data.mount: Failed with result 'exit-code'.
Dec 24 23:40:01 testlx301 kernel: CIFS VFS: Error connecting to socket. Aborting operation.
Dec 24 23:40:01 testlx301 kernel: CIFS VFS: cifs_mount failed w/return code = -101
Dec 24 23:40:01 testlx301 systemd[1]: Failed to mount Mount Share at boot.
Dec 24 23:40:01 testlx301 systemd[1]: Reached target Multi-User System.
Dec 24 23:40:01 testlx301 systemd[1]: Reached target Graphical Interface.
Dec 24 23:40:01 testlx301 systemd[1]: Startup finished in 2.201s (kernel) + 18.846s (userspace) = 21.047s.
Dec 24 23:40:02 testlx301 NetworkManager[339]: <info> [1514119202.4864] dhcp4 (wls1): address 192.168.0.231Offline