mount.cifs: permission denied after upgrading to 20.10
Try:
mount.cifs //192.168.2.2/C /mnt/mountpoint -o credentials=/home/ubuntu/.smbcredentials,iocharset=utf8
If you get an error, you might be missing a utility:
sudo apt-get install cifs-utils
If you get a no such file or directory
error, create the mountpoint:
mkdir -p /mnt/mountpoint
If you get a permission denied
error, check the permissions:
ls -ld /mnt/mountpoint
You might have to change it:
sudo chown `whoami` /mnt/mountpoint
sudo chmod 700 /mnt/mountpoint
Then try again. (Run man chmod
to learn more.)
If it still doesn't work, tweak your options until it does. Also try with sudo
for good measure, but it shouldn't be necessary.
For an easy:
mount /mnt/moutpoint
Make sure the mount you want is in /etc/fstab
. If not, add it. man fstab
for the format. Eg.
//192.168.2.2/C /mnt/mountpoint cifs credentials=/home/ubuntuusername/.smbcredentials,iocharset=utf8 2 1
Where ~/.smbcredentials
contains:
user=myuser
password=mypass
domain=WORKGROUP
(Remember to chmod 600 ~/.smbcredentials
)
Then mount again:
mount /mnt/mountpoint
No need to be in a fstab
, sudo
or mount
group.
Related videos on Youtube
IncrediblyConvoluted
Updated on September 18, 2022Comments
-
IncrediblyConvoluted over 1 year
I have a NAS that up to version 19 I could mount at startup through fstab with this command:
//192.168.1.99/data /home/user/data cifs username=uname,password=upwd,uid=user,file_mode=0660,dir_mode=0775 0 0
After having upgraded to 20.10, this has stopped working, and a check using
mount -a
returns:mount.cifs: permission denied
.I am still able to mount the drive using
sudo mount -a
, but how can I modify fstab to make it work again?-
Terrance over 3 yearsI would check the owner and permissions of the
/home/user/data
folder. According to theman mount
for "Non-superuser" mounts as long as you have the user specified infstab
it should work. -
IncrediblyConvoluted over 3 yearsThat actually did the trick, many thanks! I wonder why there was no need for an
fstab
group before? -
alebal over 3 yearsI have the same problem but I didn't understand how to solve it, can you explain it to a non-Linux expert? What should I add to my fstab?
-
IncrediblyConvoluted over 3 years@alebal, you need to create a group named fstab and add your userid to it.
sudo groupadd fstab
will create the groupsudo adduser yourusername fstab
will add you to the group -
alebal over 3 years@IncrediblyConvoluted I ran your commands, but after reboot still:mount.cifs: permission denied. I use this format: //fritz-nas/fritz.nas/PENNA_USB/FRITZ/NAS /media/NAS cifs username=myusername,password=mypassword,uid=1000,gid=1000,sec=ntlmv2,iocharset=utf8,vers=1.0 0 0, is something missing? It has always worked and with sudo mount -a it still works but at boot I don't have permission to access.
-
alebal over 3 years@IncrediblyConvoluted Still blocked... please help...
-
IncrediblyConvoluted over 3 years@alebal I'm afraid I can't help further than that, my knowledge ends right here. Hopefully someone else will be able to answer
-
alebal over 3 yearssame problem in raspberry pi with raspberry os
-
Dagelf over 3 yearssudo chown myusername /media/NAS; sudo chmod 700 /media/NAS
-
alebal over 3 yearsToday even on LMDE, after a weird reboot of router and pc... weird...
-
-
alebal over 3 yearsDon't seems to work... says: sudo mount -a mount error(2): No such file or directory Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) but all dir are correct, they work with the other format just don't work on boot...
-
Dagelf over 3 yearsYou definitely made a typo somewhere. Please share the string that doesn't work, and the one that works...
-
alebal over 3 years//fritz-nas/fritz.nas/PENNA_USB/FRITZ/NAS /media/NAS cifs username=myuser,password=mypssw,uid=1000,gid=1000,sec=ntlmv2,iocharset=utf8,vers=1.0 0 0 this work with sudo mount -a, but not on boot
-
alebal over 3 years#//fritz-nas/fritz.nas/PENNA_USB/FRITZ/NAS /media/NAS cifs credentials=/home/pi/.smbcredentials,iocharset=utf8 2 1 this show the error with sudo mount -a