LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2021, 02:32 PM   #1
Betov
LQ Newbie
 
Registered: Mar 2018
Posts: 20

Rep: Reputation: Disabled
Question 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.

Last edited by Betov; 02-16-2021 at 02:33 PM.
 
Old 02-16-2021, 03:21 PM   #2
redd9
Member
 
Registered: Nov 2013
Location: Canada
Distribution: RHEL, Ubuntu
Posts: 212
Blog Entries: 1

Rep: Reputation: 82
You checked the NTFS as well as share permissions in Windows, right?

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

Last edited by redd9; 02-16-2021 at 03:23 PM.
 
Old 02-16-2021, 03:46 PM   #3
Betov
LQ Newbie
 
Registered: Mar 2018
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by redd9 View Post
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
 
Old 02-16-2021, 03:48 PM   #4
quickbreakfast
Member
 
Registered: Oct 2015
Location: northern territory
Distribution: slackware 15
Posts: 336

Rep: Reputation: Disabled
Quote:
Originally Posted by Betov View Post

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.
 
Old 02-16-2021, 04:00 PM   #5
Betov
LQ Newbie
 
Registered: Mar 2018
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by quickbreakfast View Post
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
 
Old 02-16-2021, 04:12 PM   #6
quickbreakfast
Member
 
Registered: Oct 2015
Location: northern territory
Distribution: slackware 15
Posts: 336

Rep: Reputation: Disabled
Quote:
Originally Posted by Betov View Post
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.
 
Old 02-16-2021, 04:21 PM   #7
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by quickbreakfast View Post
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...

Last edited by HappyTux; 02-16-2021 at 04:25 PM.
 
  


Reply

Tags
cifs, mount



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount NFS error - mount.nfs: mount(2): Permission denied ndtatlive SUSE / openSUSE 1 09-20-2018 10:46 PM
VirtualBox, Share Folder: Permission denied normal user in vboxsf group parnmatt Linux - Virtualization and Cloud 0 06-08-2013 04:45 PM
manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied CADIT Linux - Newbie 6 11-20-2009 02:48 PM
NFS mount of smb mount of windows share: permission denied problem :( Bagatur Linux - Networking 4 07-07-2009 11:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration