LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permission denied after Mount Share Folder (https://www.linuxquestions.org/questions/linux-newbie-8/permission-denied-after-mount-share-folder-4175690625/)

Betov 02-16-2021 02:32 PM

Permission denied after Mount Share Folder
 
Good day

I am having problems when mounting a windows shared folder in Ubuntu. I will tell you the steps I take to mount the folder

I create a folder in ubuntu, with
Code:

sudo mkdir /mnt/folder
with that folder I can create files or see the properties of the folder

later I add the following line to the fstab as an example:

Code:

//192.168.x.x/folder /mnt/folder cifs uid=xxx,gid=xxx,credentials=/root/credential 0 0
later I mount the shared folder

Code:

sudo mount /mnt/folder
The folder is mounted correctly but it does not allow me to create files or do anything, it sends the message Permission denied

You could tell me what I'm doing wrong, thanks, the shared folder in windows is configured correctly

Note: The folder in windows is shared with write permissions

Thanks and regards.

redd9 02-16-2021 03:21 PM

You checked the NTFS as well as share permissions in Windows, right?

Edit: what is the output of ls -l /mnt/folder?

Betov 02-16-2021 03:46 PM

Quote:

Originally Posted by redd9 (Post 6221060)
You checked the NTFS as well as share permissions in Windows, right?

Edit: what is the output of ls -l /mnt/folder?

Thanks for answering, the permissions on the windows side are correct, I attach a screenshot


https://i.postimg.cc/dQkcSXnP/Sin-t-tulo.jpg

and the message he sends me is the following:


Code:

ls: reading directory '/mnt/folder/': Permission denied
total 0


quickbreakfast 02-16-2021 03:48 PM

Quote:

Originally Posted by Betov (Post 6221052)

I create a folder in ubuntu, with
Code:

sudo mkdir /mnt/folder
The folder is mounted correctly but it does not allow me to create files or do anything, it sends the message Permission denied

You could tell me what I'm doing wrong, thanks, the shared folder in windows is configured correctly

You appear to have correctly created the folder.

But since Root created the folder, root owns the folder. Therefore root controls who can modify the file(s) within the folder.

What you need to do is either, change the permissions of the folder, or change who owns the folder...... I suggest doing the latter.

To change the folder ownership use the chown command.

Reading the man page for the chown command,
Code:

man chown
should tell you everything you need to know to change the folder's ownership.

Betov 02-16-2021 04:00 PM

Quote:

Originally Posted by quickbreakfast (Post 6221068)
You appear to have correctly created the folder.

But since Root created the folder, root owns the folder. Therefore root controls who can modify the file(s) within the folder.

What you need to do is either, change the permissions of the folder, or change who owns the folder...... I suggest doing the latter.

To change the folder ownership use the chown command.

Reading the man page for the chown command,
Code:

man chown
should tell you everything you need to know to change the folder's ownership.

Thanks for answering, the problem occurs when I mount the folder, if the folder is not mounted I can check its permissions and change the owner, but if it is mounted I lose all permissions and it sends a denied message

quickbreakfast 02-16-2021 04:12 PM

Quote:

Originally Posted by Betov (Post 6221069)
if it is mounted I lose all permissions and it sends a denied message

Then when it is mounted, as root, change the folder's ownership.

By the way, since the folder has been added to your fstab, it should mount during the boot process.

HappyTux 02-16-2021 04:21 PM

Quote:

Originally Posted by quickbreakfast (Post 6221072)
Then when it is mounted, as root, change the folder's ownership.

By the way, since the folder has been added to your fstab, it should mount during the boot process.

He is telling it to mount with root permissions in the /etc/fstab line. He needs to get rid of all this junk and go with defaults in its place and then see what it does then. And it would not hurt to do a chown user_name:user_name /mnt/folder again as you have suggested to him to be certain.

Code:

uid=xxx,gid=xxx,credentials=/root/credential
Edit: BTW obscuring details like this are of no use, if a cracker has control of your system these details are easily find-able and totally useless in the penetration of a computer. The local IP and the fact there is a user named root on it, with a uid & gid...


All times are GMT -5. The time now is 08:31 AM.