fstab automount smb fails
Solution 1
As a default, only root is allowed to mount / unmount volumes. You have to allow for other users with the "user" or "users" mount option, for example:
//192.168.1.100/Daten /home/otto/Daten cifs noauto,users,credentials=/home/otto/.smbcredentials 0 0
Where the .smbcredentials
file contains username and password:
username=otto
password=wakeuplimeyfish
The noauto
option means that the system will not mount the share automatically.
Of course, you do not need all of that to mount a Windows share as a regular user. Just open a file manager window and go to Browse Network -> Windows Network, select the share you want to mount, type the password etc. Or give the location (menu go -> location): smb://Fileserver/share
, type in your domain / password etc.
Or use gvfs directly from command line:
gvfs-mount 'smb://user@fileserver/share'
Solution 2
I have succeeded in this, by doing the following on fstab
//192.168.1.1/SharedFolder /mnt/SharedFolder cifs guest,uid=1000,iocharset=utf8,codepage=unicode,unicode 0 0
make sure you have created the /mnt/SharedFolder location, and have given regular users permissions to read/write
Solution 3
Did you create the ~/.smbcredentials as required?
read: https://wiki.ubuntu.com/MountWindowsSharesPermanently
Related videos on Youtube
jeremyjjbrown
Updated on September 18, 2022Comments
-
jeremyjjbrown over 1 year
I'm trying to automount some drives with smb with fstab entries as such.
# auto mount hda shares //hda/DeannasDocs /home/deanna/DeannasServerDocs cifs user=deanna,pasword=** 0 0 //hda/Music /home/deanna/ServerMusic cifs user=deanna,pasword=** 0 0 //hda/Pictures /home/deanna/ServerPhotos cifs user=deanna,pasword=** 0 0
if I click on one of these drives I get an error "only root can mount"
If I manually mount with
sudo mount -a
I'm prompted for a password and they mount just fine. What the heck is going on here?
Answer: Of course it was something stupid.
I copied the syntax for the mount from offline and it has "pasword" instead of "password". It stood out initially but I thought it was just a Unix foible.
-
jeremyjjbrown over 11 years"As a default, only root is allowed to mount / unmount volumes." so is fstab not loaded by root at startup anymore? Realistically, my wife is not going to manually mount our media shares.
-
jeremyjjbrown over 11 yearsI'm just not going to give regular users permissions on my home server.
-
jeremyjjbrown over 11 yearsAccording to that document my fstab is exactly correct.
-
jeremyjjbrown over 11 years"According to that document my fstab is exactly correct." I guess it was not exactly correct. Thanks!