
私は3台のマシンを持っています -
machineA 10.108.24.132
machineB 10.108.24.133
machineC 10.108.24.134
これらのマシンにはすべて Ubuntu 12.04 がインストールされており、私はこれら 3 台のマシンすべてに対してルート アクセス権を持っています。
今、私は上記のマシンで以下のことを行う予定です -
Create mount point /opt/exhibitor/conf
Mount the directory in all servers.
sudo mount <NFS-SERVER>:/opt/exhibitor/conf /opt/exhibitor/conf/
/opt/exhibitor/conf
前述のように、これら 3 台のマシンすべてにすでにディレクトリを作成しています。
今、私はこれら3台のマシンすべてにマウントポイントを作成しようとしています。そこで、以下の手順に従いました。
NFSサポートファイルとNFSカーネルサーバーをインストールする
$ sudo apt-get install nfs-common nfs-kernel-server
共有ディレクトリを作成する
$ mkdir /opt/exhibitor/conf/
/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)
#
/opt/exhibitor/conf/ 10.108.24.*(rw)
exportfsを実行する
root@machineA:/# exportfs -rv
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "10.108.24.*:/opt/exhibitor/conf/".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
exporting 10.108.24.*:/opt/exhibitor/conf
今私はやっshowmount
たmachineA
root@machineA:/# showmount -e 10.108.24.132
Export list for 10.108.24.132:
/opt/exhibitor/conf 10.108.24.*
そして今これをやるとエラーが発生します -
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
mount.nfs: access denied by server while mounting 10.108.24.132:/opt/exhibitor/conf
ここで私が何を間違っているのか分かりますか?
答え1
/etc/exportsを次のように変更します。
/opt/exhibitor/conf/ 10.108.24.*(rw)
に
/opt/exhibitor/conf/ 10.108.24.0/24(rw)
答え2
同じサーバー上でNFSマウントをしようとしているようです
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
マシンAは10.108.24.132
試しましたか?
root@machineB:/# mkdir -p /opt/exhibitor/conf
root@machineB:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
そしてマシンC
root@machineC:/# mkdir -p /opt/exhibitor/conf
root@machineC:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
machineA から、マウント ポイントとして別のディレクトリを使用すれば、次の操作を実行できるはずです。
root@machineA:/# mkdir -p /opt/exhibitor/conf2
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf2/
答え3
初めまして。私の英語はとても下手で申し訳ありません。でも、できる限り上手に書くように努力します。
マウント時にユーザー名とパスワードを設定する必要があると思います。
mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/ -o username=USERNAME,password=PASSWORD
私は NFS を試したことがなく、自分のマシンでは samba を使用しています。samba では、samba ユーザーに Linux ユーザーを追加する必要があります。
smbpasswd -a username
おそらくNFSでも同じケースでしょう。