LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-13-2012, 12:53 AM   #1
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Rep: Reputation: Disabled
NFS access denied by server while mounting


I'm trying to mount my server NFS share on my laptop. Both are running Debian. The server IP address is 192.168.0.69 and the laptop IP address is something like 192.168.0.100 (assigned by DHCP). When I do
Code:
sudo mount -t nfs 192.168.0.69:/media/nfs/ /home/laptop/nfs/
I get this error:
Code:
mount.nfs: access denied by server while mounting 192.168.0.69:/media/nfs/
This is in my /etc/exports file on the server:
Code:
/media/nfs/   192.168.0.*     (ro,sync,hard,intr)
Where did I go wrong?
 
Old 03-13-2012, 02:05 AM   #2
akcgi
LQ Newbie
 
Registered: Mar 2012
Location: Shijiazhuang, China
Posts: 4

Rep: Reputation: Disabled
/media/nfs/ 192.168.0.0/24 (ro,sync)


try again

you don't write mask
 
1 members found this post helpful.
Old 03-13-2012, 02:08 AM   #3
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
add this in your exports file
Code:
/media/nfs/   192.168.0.*(ro,sync,hard,intr,no_root_squash)
this will allow usgae of nfs by root with full permission or else by default nfs server is mounted using nobody user

Code:
#exportfs -a
to update your exports file

and kindly post your /var/log/messages if it is related to some other problem

Last edited by deep27ak; 03-13-2012 at 05:40 AM.
 
2 members found this post helpful.
Old 03-14-2012, 02:04 AM   #4
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Original Poster
Rep: Reputation: Disabled
I did not know about #exportfs -a. When I try using that with my configuration (or if I add the no_squash_root option), I get this message:
Code:
exportfs: /etc/exports:1: unknown keyword "hard"
The "hard" option should be valid, right? What does it say that it is unknown?

When following akcgi's suggestion, #exportfs -a gives this:
Code:
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.0.0/24:/media/nfs/".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x
In both cases, when mounting on the client, I get a long wait and then this:
Code:
mount.nfs: Connection timed out
Here is /var/log/messages for the server:
Code:
Mar 14 00:33:42 server rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="972" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
Here is /var/log/messages for the laptop (client): http://pastebin.com/riEXysvs It's on Pastebin because it's too huge.

I don't see anything relevant in those, but maybe you can.
 
Old 03-14-2012, 07:26 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
The option hard is used during the mount, i.e. on the client side. Either on the command line or in /etc/fstab.

Is anything blocked in /etc/hosts.allow resp. /etc/hosts.deny?

NB: Don’t use a blank between the network address (i.e. the host specification) and the option list, this will generate two separate entries: one without any options for the mentioned address (and the default will be used), and one with the options for all other machines around there (as an limiting address is missing).

NB2: The wildcard is to be used with domain names, not with addresses IIRC.
 
1 members found this post helpful.
Old 03-15-2012, 01:29 AM   #6
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Original Poster
Rep: Reputation: Disabled
My hosts files are empty except for comment lines beginning with #. This should make the server open to all hosts by default, correct?

I also removed the option intr from the server exports file. I'm using my laptop's current IP address, 192.168.0.105 in case the IP address wildcard was causing an issue. I accidentally wrote "no_squash_root" instead of "no_root_squash", so I fixed that. This is my exports file:
Code:
/media/nfs/   192.168.0.105(ro,sync,no_root_squash)
I'm mounting with this command:
Code:
#sudo mount -t nfs -o hard,intr 192.168.0.69:/media/nfs/ /home/laptop/nfs/
but it still gives me this:
Code:
mount.nfs: Connection timed out
 
Old 03-15-2012, 04:01 AM   #7
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
is your nfs up and running properly on the server?

have you tried this command?
Code:
#exportfs -a
Code:
#service nfs restart
check the log message on client machine
Code:
#cat /var/log/messages
 
1 members found this post helpful.
Old 03-15-2012, 04:15 AM   #8
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Original Poster
Rep: Reputation: Disabled
This command:
#service nfs restart
gives this:
nfs: unrecognized service

edit- Oh, I think the above is a Redhat-only method. I just used the corresponding Debian method. I restarted these two services:
Code:
# /etc/init.d/nfs-common restart
Stopping NFS common utilities: idmapd statd.
Starting NFS common utilities: statd idmapd.
Code:
# /etc/init.d/nfs-kernel-server restart
Stopping NFS kernel daemon: mountd nfsd.
Unexporting directories for NFS kernel daemon....
Exporting directories for NFS kernel daemon...exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.0.105:/media/nfs/".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

.
Starting NFS kernel daemon: nfsd mountd.
Now when I mount with this command:
Code:
#mount -t nfs -o hard,intr 192.168.0.69:/media/nfs/ /home/laptop/nfs/
I get this:
Code:
mount.nfs: access denied by server while mounting 192.168.0.69:/media/nfs/
That looks like progress, but where do I go from here?

Last edited by Lumify; 03-15-2012 at 04:30 AM.
 
Old 03-15-2012, 04:24 AM   #9
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
I am extremely sorry the command I gave was for RHEL. I am not sure about debian. You just need to restart nfs server
 
1 members found this post helpful.
Old 03-15-2012, 04:32 AM   #10
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Original Poster
Rep: Reputation: Disabled
No problem, I realized just after I posted. (see above)
 
Old 03-15-2012, 06:30 AM   #11
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
can you try mounting using this command and make sure portmap service is running on server

Code:
#mount -t nfs -v 192.168.0.69:/media/nfs/ /home/laptop/nfs/
and post the last log messages related to nfs server
Code:
#cat /var/log/messages
on client machine

also check the firewall and selinux on server as well as client
and post the version of nfs on server and client

Last edited by deep27ak; 03-15-2012 at 06:33 AM.
 
1 members found this post helpful.
Old 03-16-2012, 03:20 AM   #12
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Original Poster
Rep: Reputation: Disabled
To make sure portmap is running:
Code:
(on server)
# /etc/init.d/portmap restart
Stopping portmap daemon....
Starting portmap daemon....

# /etc/init.d/portmap status
portmap is running.
I gave my laptop a static IP, 192.168.0.13, to make this more simple. I used exportfs -a and restarted the nfs server service.
Code:
(on laptop)
# mount -t nfs -v 192.168.0.69:/media/nfs/ /home/laptop/nfs/
mount.nfs: timeout set for Fri Mar 16 01:57:53 2012
mount.nfs: trying text-based options 'vers=4,addr=192.168.0.69,clientaddr=192.168.0.13'
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.0.69:/media/nfs/
There isn't much in the messages related to NFS, so I grep'd it. Nothing comes up immediately when I try mounting the share.
Code:
(on laptop)
# cat /var/log/messages|grep nfs
Mar 13 21:39:37 debian kernel: FS-Cache: Netfs 'nfs' registered for caching
Mar 13 21:39:37 debian kernel: Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Mar 15 01:33:00 debian kernel: FS-Cache: Netfs 'nfs' registered for caching
Mar 15 01:33:00 debian kernel: Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Mar 15 23:51:12 debian kernel: FS-Cache: Netfs 'nfs' registered for caching
Mar 15 23:51:12 debian kernel: Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

# cat /var/log/messages|grep NFS
Mar 13 21:39:37 debian kernel: RPC: Registered tcp NFSv4.1 backchannel transport module.
Mar 15 01:33:00 debian kernel: RPC: Registered tcp NFSv4.1 backchannel transport module.
Mar 15 23:51:12 debian kernel: RPC: Registered tcp NFSv4.1 backchannel transport module.
Code:
(on server)
# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

# dpkg --status nfs-common
...
Version: 1:1.2.2-4squeeze2
...


# dpkg --status nfs-kernel-server
...
Version: 1:1.2.2-4squeeze2
...
Code:
(on laptop)
# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

# dpkg --status nfs-common
...
Version: 1:1.2.5-4
...

(nfs-kernel-server isn't installed on laptop)
What could I check about SELinux? I'm not familiar with it, and I'm still kind of confused about what it is after a search.
 
Old 03-16-2012, 04:11 AM   #13
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
stop your firewall and disable the selinux

Code:
#/etc/init.d/iptables stop
Code:
#vi /etc/sysconfig/selinux
selinux=disabled
these two services should be running on server

Code:
#rpcinfo -p
100021    4    tcp6      ::.157.164             nlockmgr   unknown
100000    4    tcp6      ::.0.111               portmapper superuser
 
2 members found this post helpful.
Old 03-16-2012, 05:01 AM   #14
Lumify
Member
 
Registered: Jan 2012
Distribution: Debian Stable
Posts: 52

Original Poster
Rep: Reputation: Disabled
/etc/init.d/iptables doesn't exist. The directory /etc/sysconfig/ also doesn't exist. Does that mean I don't have to worry about these?

Code:
# rpcinfo -p
   program vers proto   port
    100000    2   tcp    111  portmapper
    100024    1   udp  36849  status
    100024    1   tcp  47263  status
    100000    2   udp    111  portmapper
    100021    1   udp  34940  nlockmgr
    100021    3   udp  34940  nlockmgr
    100021    4   udp  34940  nlockmgr
    100021    1   tcp  60818  nlockmgr
    100021    3   tcp  60818  nlockmgr
    100021    4   tcp  60818  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100005    1   udp  52727  mountd
    100005    1   tcp  42462  mountd
    100005    2   udp  52727  mountd
    100005    2   tcp  42462  mountd
    100005    3   udp  52727  mountd
    100005    3   tcp  42462  mountd
 
Old 03-16-2012, 05:17 AM   #15
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
follow these two link to disable firewall and selinux in debian

http://www.cyberciti.biz/faq/debian-iptables-stop/
http://www.cyberciti.biz/faq/how-to-...nhanced-linux/

and check for port 111 in your server

Code:
#netstat -ntlp | grep 111
if it is listening then retry mounting NFS on client
 
1 members found this post helpful.
  


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.nfs: access denied by server while mounting physnastr Linux - General 2 10-02-2011 03:33 PM
Tried everything but still get: "mount.nfs: access denied by server while mounting" timjowers Linux - Networking 3 04-21-2011 08:23 PM
mount.nfs: access denied by server while mounting DD554 Linux - Networking 1 05-08-2010 12:22 PM
NFS mount mount.nfs: access denied by server while mounting knockout_artist Linux - Newbie 2 11-26-2008 02:36 PM
mount.nfs: access denied by server while mounting mokrunka Linux - Networking 4 10-07-2008 12:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:38 AM.

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