LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2013, 01:13 PM   #1
jim.thornton
Member
 
Registered: May 2007
Posts: 430

Rep: Reputation: 19
Can't mount share -- access denied.


I'm trying to setup a share between two Linux Mint computers. I have setup the share on my fathers computer and now trying to access it on my mothers computer.

I have tried using NFS and Samba and can't seem to do it. I'm thinking that I have the users or something wrong.

My fathers computer has a username of dad and my mothers mom. Both passwords are the same, let's say "password" for this example.

NFS:
I installed nfs-kernel-server and nfs-common.
I went to the folder in MATE and right-clicked
selected Share Folder
Setup share vis NFS with the IP of 192.168.1.0/24
Clicked Share
** There share symbol appeared in the file manager.

On my mother's computer I installed nfs-common and then tried mounting the share:

sudo mount -t nfs 192.168.1.101:/home/dad/sharename /media/sharedir

But when it went to mount it kept saying access is denied.

I searched and searched trying different settings in the /etc/export file. No luck!

I gave up and I switched to SMB. I removed the share that I setup in MATE and then reset the share using SMB. I do this in my house all the time.

Here is what I type:
sudo mount -t cifs //192.168.1.101/Scanned /media/Scanned\ Items

It is asking me for a password even though I have set the share public.

I don't know why this is happening. Can someone please help me.

I tried setting the permissions of the shared folder to 777 but it still isn't working.
 
Old 09-10-2013, 01:51 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
A few things about nfs:
You need the correct settings in /etc/exports and correct permissions on the share.
Easiest way is to have the same user in all systems, then you don't need to fiddle with permissions, mount-users and such.

The way I do it:
Same user "pingu" with same UID on client & server.
Servers /etc/exports:
Code:
/mnt/data       192.168.0.0/24(rw,sync)
/mnt/multimedia 192.168.0.0/24(rw,sync)
Permissions on the shares:
Code:
$ ls -l /mnt/
drwxr-xr-x 7 pingu root       64 Jul 19  2011 data
drwxr-xr-x 5 pingu users      42 Dec  4  2011 multimedia
Entry in clients fstab:
Code:
192.168.0.3://mnt/multimedia    /mnt/mm nfs     user,noauto     0 0
192.168.0.3://mnt/data  /mnt/data       nfs     user,noauto     0 0
Now on client I can mount the 2 shares as my ordinary user, and has read-write access to them.

---
Edit:
Now if several users are to access the same share read-write, then add them to a group and set permissions on servers shares on the server to allow read-write for group.
Also create same group in client. (This is just one way to do it, as always there are several other do it. With just a few home computers I find this to be the easiest.)
---
Samba unfortunately I don't know. Tried myself once to have a Public share but got the same problem. Didn't bother to dig into it.
But if all computers are running Linux I'd go for NFS - smb is really needed for Windows only.

Last edited by pingu; 09-10-2013 at 01:54 PM.
 
Old 09-10-2013, 02:55 PM   #3
jim.thornton
Member
 
Registered: May 2007
Posts: 430

Original Poster
Rep: Reputation: 19
Okay, here is what I've done. But it still isn't working:

Users:
Dad = jthornton
Mom = ellen (uid 1001 on both machines)
** I created the user on the SERVER and did not reboot. I added ellen to the group 'users'. On the SERVER the UID is 1001.
** I then went to the client and the UID for ellen was 1000 so I changed to 1001 and then logged out and back in.

Server: /etc/exports
Code:
$ cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#		to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/home/jthornton/Documents/Personal/Scanned 192.168.1.0/24(rw)
Server Shared directory: /home/jthornton/Documents/Personal/Scanned
Code:
$ ls -lah
total 12K
drwx------  3 jthornton jthornton 4.0K Sep 10 12:23 .
drwxr-xr-x 29 jthornton jthornton 4.0K Sep  8 07:31 ..
drwxr-xr-x  2 jthornton users     4.0K Aug  8 23:55 Scanned
I added to /etc/fstab on the CLIENT:
Code:
192.168.1.101:/jthornton/Documents/Personal/Scanned /media/Scanned\ Items     nfs    user,noauto     0 0
I ran $ sudo mount -a and got a "bad line" error regarding the fstab entry I made.
 
Old 09-10-2013, 04:04 PM   #4
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
1. Using backslash doesn't work in fstab IIRC. Always try to avoid blanks in file- & dirnames, makes things easier.
Either use underscore in dir-name or enclose the mount-path with quotes.
2.
Code:
$ ls -lah
total 12K
drwx------  3 jthornton jthornton 4.0K Sep 10 12:23 .
So only user 'jthornton' has access to lower level directories and thus 'ellen' can not enter the exported directory?
--- Correcting
"So only user 'jthornton' has access to " the exported directory

Last edited by pingu; 09-10-2013 at 04:43 PM. Reason: Correcting written-in-haste
 
Old 09-10-2013, 04:22 PM   #5
jim.thornton
Member
 
Registered: May 2007
Posts: 430

Original Poster
Rep: Reputation: 19
So does that mean that I have to change the group for every directory all the way back to /home??
 
Old 09-10-2013, 04:42 PM   #6
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
No, that's not correct. Sorry I wasn't very clear.
The mounted directory "/home/jthornton/Documents/Personal/Scanned" must have proper permissions - the permissions on that directory on the server are applied on client when mounted.
On your server only user jthornton has access to the mounted directory, this means noone else can access this directory.

It's quite simple really, when you export a directory using nfs, normal permissions apply.
Permissions on server = permissions on client.
If you can't access one directory you can't access anything above it. Using nfs, this applies to mountpont & above.
Hope it's clearer?

Anyway, correct /etc/fstab first then fiddle with permissions.
 
Old 09-10-2013, 05:31 PM   #7
jim.thornton
Member
 
Registered: May 2007
Posts: 430

Original Poster
Rep: Reputation: 19
Okay... I changed "Scanned\ Items" to just "Scanned" and now I don't get an error when running "mount -a".

The location "Scanned" now shows up on the left side on the file manager, but when i click on it I get an error saying that the permissions were denied by the server. So, now I just need to figure out the permissions. I figured the easiest way to do that was to type ALT+F2 and then login to the command line with the username 'ellen' and try to access the shared directory. i got an access denied message for that too (on the server).

I changed the permissions to 777 and tried again and still got a message (do I need to restart the nfs-kernel-server after changing permissions)?

Here is my directory listing currently (that is giving me access denied):
Code:
~/Documents/Personal $ ls
total 12K
drwx------  3 jthornton users     4.0K Sep 10 12:23 .
drwxr-xr-x 29 jthornton jthornton 4.0K Sep  8 07:31 ..
drwxrwxrwx  2 jthornton users     4.0K Aug  8 23:55 Scanned
BTW... ellen and jthornton are both members of group 'users' now.

Last edited by jim.thornton; 09-10-2013 at 05:32 PM. Reason: addition
 
Old 09-10-2013, 07:47 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 11,220

Rep: Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669Reputation: 2669
My understanding is that with nfs, you need to re-start the server after any change for it to take effect.
 
Old 09-10-2013, 10:24 PM   #9
jim.thornton
Member
 
Registered: May 2007
Posts: 430

Original Poster
Rep: Reputation: 19
Again, I used the ALT+F2 terminal to login with ellen and was testing it to try and access the directory for the Scanned directory. It seems that in order to access the directory as ellen, on the server I needed to:

$ sudo chown jthornton:users /home/jthornton/Documents/Personal
$ sudo chown jthornton:users /home/jthornton/Documents/Personal/Scanned

Then I needed to:
$ cd /home/jthornton/documents
$ chmod 770 Personal
$ cd Personal
$ chmod 770 Scanned

Once I did that everything worked when mounting on the client side. If I did something insecurely please let me know. Otherwise, thank you for your help!!!
 
Old 09-11-2013, 01:59 AM   #10
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Good you solved it!
Just want to add that you don't need to restart nfs if you just change permissions. You'll probably need to remount the share though.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] mount error 13 = Permission denied, when trying to access an smb share Zarniwoop79 Linux - Server 2 09-13-2009 07:59 AM
NFS mount of smb mount of windows share: permission denied problem :( Bagatur Linux - Networking 4 07-07-2009 12:34 PM
Samba Share = Network Access is Denied surban99 Linux - Software 2 04-10-2009 02:54 PM
Permission denied trying to mount nfs share leupi Linux - Networking 1 07-30-2007 02:32 AM
Access denied when attempting access samba share warlockvix Linux - Software 1 05-11-2007 03:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:18 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