Mount error 13 permission denied in linux

cifs, smb — Can’t mount (permission denied) or navigate shared folder

I’ve recently bumped into this problem. I usually navigate through a local network shared folder from a Linux machine via smb (i.e. from file manger using smb: ). Now whenever I try to access the shortcut or typing credential again I keep getting the dialog window asking for user, domain and password. So I tried mounting the location manually using cisf-utils doing:

sudo mount -t cifs //fileshare1/docs1/user/My\ Documents/shared/Francesco/ /home/frank/used_shared/ -o username=my_user,password=my_pass,domain=my_domain,gid=1000,uid=1000 

I get mount error(13): Permission denied . I’m definitely sure my user has permission on that folder cause I can access it from a windows machine. Also if I try to mount my personal folder on that location through:

sudo mount -t cifs //fileshare1/docs5/francesco.azzarello/ /home/frank/mnt_folder -o username=my_user,password=my_pass,domain=my_domain,gid=1000,uid=1000 

I can access it with no problem. For reference I’m using 4.2.0-36-generic kernel and my mount.cifs version is 6.4 Any idea on how to make one of both methods work? Update Rgarding ponsfrilus answer number 1: verbose option returns:

_mount.cifs kernel mount options: ip=xxx.xxx.xxx.xxx,unc=\\fileshare1\docs1,uid=1000,gid=1000,user=my_user,,domain=my_domain,prefixpath=user/My Documents/shared/Francesco/,pass=******** mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)_ 
_ mount.cifs kernel mount options: ip=xxx.xxx.xxx.xxx,unc=\\fileshare1\docs1,iocharset=utf8,file_mode=0777,dir_mode=0777,user=my_user,,domain=my_domain,prefixpath=user/My Documents/shared/Francesco/,pass=******** mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)_ 
_mount.cifs kernel mount options: ip=xxx.xxx.xxx.xxx,unc=\\fileshare1\docs1,vers=2.1,iocharset=utf8,file_mode=0777,dir_mode=0777,user=my_user,,domain=my_domain,prefixpath=user/My Documents/shared/Francesco/,pass=******** mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)_ 

As for number 4 I can mount docs1 no problem but I can navigate tho get to the shared folder in user.

Источник

Монтирование сетевой папки, настройка прав

В локальной сети есть два сентоса 7. На обоих настроена samba.

Первый используется как файловый сервер с распределенным доступом. Настроено несколько папок, разные группы подключаются, в основном с виндовских машин по паролям, проблем не было.

Сейчас с другого сентоса 7 примонтировать сетевую папку с файлового сервера как обычную, родную папку. Доступы по паролям.

[global] workgroup = WORKGROUP security = user map to guest = bad password netbios name = FileServer server string = FileServer [pm] path = /mnt/pm browseable = no writable = yes read only = no guest ok = no valid users = @pm create mask = 0777 directory mask = 0777 

2. Создана папка /mnt/pm с правами 777

3. Создан пользователь pm c паролем 111111, сделала его владельцем папки папка /mnt/pm, как пользователя самбы его тоже завела.

1. Создан пользователь pm c паролем 111111

2. pm — владелец папки files, в которую монтирую сетевую папку

 drwxrwxr-x 3 pm pm 33 ноя 24 17:50 files 

Подключаюсь с клиента к файловому серверу:

smbclient //192.168.1.101/pm -U pm Enter pm's password: Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10] smb: \>
mount.cifs //192.168.1.101/pm/ /opt/files -o user=pm -o password=111111 mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) 

1. Каких прав кому не хватает?

Читайте также:  Linux команда информация об оперативной памяти

2. Как разрешить подключение только этой группе (pm)?

Нужно найти владельца твоей мамки, вендузятник

Скорее всего, оно ругается на множественные опции, перечисляйте их через запятую.

Сам-то давно с окошек слез, петушок?

Версия cifs-utils

yum info cifs-utils Загружены модули: fastestmirror Determining fastest mirrors * base: mirror.corbina.net * epel: mirror.yandex.ru * extras: mirror.corbina.net * updates: mirror.corbina.net Установленные пакеты Название: cifs-utils Архитектура: x86_64 Версия: 6.2 Выпуск: 7.el7 Объем: 174 k Источник: installed Из источника: base Аннотация: Utilities for mounting and managing CIFS mounts Ссылка: http://linux-cifs.samba.org/cifs-utils/ Лицензия: GPLv3

А на что влияет версия? Ставила из yum.

Попробуйте добавить параметр sec=ntlm

Команда в итоге должна выглядеть так:

 mount -t cifs //192.168.1.101/pm/ /opt/files -o sec=ntlm,username=pm,password=111111

Спасибо Вам, большое.

Действительно, синтаксис не тот. Примонтировалось на ура! И в автозагрузку добавила с этим же параметром sec=ntlm.

Реанимирую тему

Решение работает, директория монтируется под рутом, тему отложила.

Теперь обнаружила, что не смотря на монтирование пользователем pm, залогинившись пользователем pm я не могу зайти в примонтированную директорию. Всё тот же permission deny.

Примонтировать сетевую директорию в /opt/files — монтирую командой

mount -t cifs //192.168.1.101/pm/ /opt/files -o sec=ntlm,username=pm,password=111111

. Директория монтируется без ошибок. На файловом сервере есть пользователь pm с паролем 111111, и с паролем от самбы, также 111111, он владелец директории /mnt/pm. В самбе прописаны valid users = @pm на /mnt/pm.

Смотрю на директорию files командой

ls -la /opt/ - drwxrwx---+ 4 1019 1023 0 ноя 25 11:47 files

т.е. владельцем директории система видит не пользователя pm, а uid пользователя pm на файловом сервере. Поменять владельца files — отказано в доступе даже для root. Залогинилась пользователем pm — не могу войти в директорию files, когда в нее примонтирована сетевая директория.

У локального и удалённого юзера идентификаторы могут отличаться.
Также надо учитывать, что у вас монтирование реализовано не юзером, а рутом.
Один из способов решения:

man mount.cifs | grep -A2 '^ *[ug]id='

Источник

Unable to mount CIFS share on Linux: mount error(13): Permission denied (cifs_mount failed w/return code = -13)

There are a couple of ways how to mount a CIFS/Samba share on a Linux client. However some tutorials are outdated and meanwhile completely wrong. I just ran into a (stupid) case of a wrong mount.cifs syntax:

root@focal:~# mount -t cifs //server/Share /mnt -o rw,user=domain\myuser,password=secret
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

Unfortunately, the additional output in dmesg is not helpful to figure out the problem:

root@focal:~# dmesg
[. ]
[16444886.307684] CIFS: Attempting to mount //server/Share
[16444886.307717] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[16444886.539770] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[16444886.539795] CIFS VFS: \\server Send error in SessSetup = -13
[16444886.539901] CIFS VFS: cifs_mount failed w/return code = -13

Читайте также:  Линукс лучше чем виндовс чем лучше чем виндовс

After additional try and errors (and looking up a recent share mount from the history), the problem turned out to be the user=domain\myuser syntax. This way of combining the domain/workgroup and the username is not working (anymore).

Note: Both user= and username= are accepted in the options.

root@focal:~# mount -t cifs «//server/Share» /mnt -o «user=myuser,password=secret,workgroup=DOMAIN»
root@focal:~# ll /mnt/
total 0
drwxr-xr-x 2 root root 0 Sep 1 2020 _Archiv
drwxr-xr-x 2 root root 0 Aug 9 12:10 Client
[..]

Of course the password should not be used on the command line, so for the final (and automatic) mount of the share use the following entry in /etc/fstab:

root@focal:~# cat /etc/fstab
[. ]
# Mount CIFS share from server
//server/Share /mnt cifs rw,relatime,vers=3.1.1,credentials=/etc/samba/servershare.conf,uid=0 0 0

Where /etc/samba/servershare.conf contains the credentials:

root@focal:~# cat /etc/samba/servershare.conf
user=myuser
password=secret
domain=DOMAIN

Add a comment

Comments (newest first)

Edgardo Pannunzio (KERNEL Consultores) from Uruguay wrote on Feb 9th, 2023:

Thanks very much !!
Your post was really helpful.

Ed from wrote on Jan 27th, 2023:

In my case (mounting win 2019 share in RHEL9) when using double apostrophe: «user=myuser. » was outputing:
«bash: !,workgroup=$MY_DOMAIN: event not found»

Switching to single apostrophe ‘user=mysers. ‘ did the trick

ck from Switzerland wrote on Nov 29th, 2022:

Keith, make sure you have the cifs-utils and smbclient packages installed on your Ubuntu. Still an error? Try to connect to the share using the smbclient command. It could also be a SMB protocol mismatch. Check out this article, describing Samba protocol configuration on the client.

Keith from United States wrote on Nov 29th, 2022:

I’ve tried for the past 3 hours, 5AM in the morning now, and I’ve tried everything from every other website and this one and still get the exact same errors. Tried it with just sudo, then root. Same thing. Host OS is ubuntu server trying to mount a network share from my Synology NAS.

AJav from wrote on Sep 19th, 2022:

simonpunk2016 from wrote on Aug 1st, 2022:

Thank you sir, never know the mount option has changed, because I just successfully mounted the cifs last month, thought my Manjaro has come to an end.

simonpunk2016 from wrote on Jul 29th, 2022:

Thank you sir, never know the mount option has changed, because I just successfully mounted the cifs last month, thought my Manjaro has come to an end.

Jesko from wrote on Feb 10th, 2022:

I had exact the same error, but different reason. On a freshly installed (old) Ubuntu 16.04 LTS (last 32Bit version). My reason was: There was no cifs-utils installed! so «sudo apt install cifs-utils» was the solution. I just write here because I crawled through hundreds of comments.

Blog Tags:

© 2008 — 2023 by Claudio Kuenzler. Powered by .

This website uses own and third-party 🍪 cookies to improve your browsing experience. By continuing using our website you agree to the Cookie and Privacy Policy. I agree

Источник

Mount CIFS Permission Denied on Linux – Fixed!

mount cifs permission denied easy

In this tutorial, I show you how to fix the Mount CIFS Permission Denied error on Linux.

Читайте также:  Linux mint rescue grub

Table of Contents

Mount CIFS Permission Denied Error

The error occurs mostly because you don’t provide sufficient credential information, specifically which Domain you are in. Most Tutorials out there only mention username and password when editing the .smbcredentials file. But let me take you through the process from the beginning.

Step 1 – Installing CIFS Utils

To mount a CIFS share on Linux, we first need to install cifs-utils. Let’s get started with that.

sudo apt-  It should probably be pre-installed in most distros anyway.

Step 2 – Creating a Mount Point

Next, we need to create the directory where we want to Mount our Share in. You can later find the Share in this Directory. For this example, we will mount the imaginary “Photos” share.

Step 3 – Editing the fstab file

That we don’t have to mount our Share again after each reboot, we have to edit the fstab file to make the Share mount automatically after each reboot. But first, we make a backup of this file in case something goes wrong.

That done, we edit our fstab file.

And paste this line at the end of the file (all in one line)

Of course, adjust accordingly to your own Server and YourLinuxUsername! We will create the .smbcredentials file next.

By default, you will have the gid=1000 and uid=1000. That’s your Group & User ID, but to make sure that those values are the same in your system, double-check it by typing:

If all is correct, hit CTRL+S to Save the fstab file and close it.

mount cifs permission denied

Step 4 – Creating the .smbcredentials file

We could enter our username directly into our fstab file, but that would not be safe as someone could clearly read our Username and Password in this unencrypted file. Therefore, we are going to create a separate file containing this information.

 And here is the key point to fixing the Mount CIFS Permission Denied error. Most guides simply state to enter Username and Password into this file, but you also have to enter your Domain!

So paste this into your .smbcredentials file:

Save & Close the file.

Now we just make the .smbcredentials file so that only the root user can read its contents.

Step 5 – Mounting the Share

Now when everything is done, try to mount the share by typing

And your share should now be successfully mounted! If there are still some errors, try rebooting your system and see again if the Share was mounted. The share should be located in your media/share/Photos folder.

Wrapping up

It took me a while to figure out this error. I use a Synology NAS and had to set vers=2.0 in the fstab file. If you still encounter problems, try changing vers to 1.0 or 3.0. Let me know in the comments below if this solution worked for you!

Источник

Оцените статью
Adblock
detector