Wednesday 9 October 2013

Unexpected permission issues when mounting nfs shares (mainly OSX)

The Problem

Some directories are exported via nfs on a linux server. Attempting to mount from OSX produces permission-related errors (Lion), or dialog boxes that advertise a failure to mount but disappear before they can be read (Snow Leopard).

Meanwhile, on the client the command
showmount -e ip_address
correctly shows the exported directories that you expect.

The Solution

This may be down to the server having a default of "expect client to connect over a reserved port", in which case, depending on which end you have control over, modify the way the client connects, or the way the directory is served.

1) In the client: mount the share from the command line, requesting that the connection be made via a reserved port.
e.g. mount -o resvport,rw,noowners -t nfs ip_address:/path/to/share /path/to/mount/point

2) In the server: tell the server not to expect connections over reserved ports.
i.e. edit /etc/exports and add the magic word "insecure" to the relevant mount description
e.g. /path/to/share *(rw,insecure,sync,no_root_squash)

Friday 4 October 2013

How to get bash to stop escaping $ during tab-completion

Once upon a time I could type
ls $HOME/f
and bash would expand this to whatever file started with 'f', or a list of all the candidates.

Now (2013 - and for quite some long irritating time) bash has been "improved" so that the above request shows:
ls \$HOME/f
which is completely useless.
(Who did that help?   What problem did it fix?)

The old behaviour can be restored by putting this in some bashrc, or executing it within bash:
shopt -s direxpand
... presuming that you have a sufficiently recent version of bash to have both the problem and the capacity to fix it. Sigh.