2.2 Make it sure that ports 88 and 749 has opened at the firewall. Restart the firewall.
2.3 Create Kerberos Principals:

Execute kadmin command on the client console. Add the principal to the keytab file as follows for NFS :

Raw

[root@client ~]# kadmin
Authenticating as principal root/admin@EXAMPLE.COM with password.
Password for root/admin@EXAMPLE.COM:
kadmin: ktadd -e des-cbc-crc:normal nfs/client.example.com

Configuring kerberos for NFSv4 (Assuming that NFSv4 has been installed on the server), on the kerberos (i.e NFSv4) server :

3.1 Create the necessary entries in /etc/exports. First, create an NFSv4 mount point. I would suggest /export. Next bind the real path to the NFSv4 mount point. In this example, we want to export the /data directory. We create /export/data for NFSv4 and mount /data there.

Raw

[root@server /]# mkdir -m 1777 /export
[root@server /]# mkdir /export/data
[root@server /]# mount -n --bind /data /export/data

3.2 Add the following lines in the /etc/exports file :

Raw

/export      gss/krb5(sync,rw,fsid=0,insecure,no_subtree_check,anonuid=65534,anongid=65534)
/export/data gss/krb5(sync,rw,nohide,insecure,no_subtree_check,anonuid=65534,anongid=65534)

3.3 Modify /etc/idmapd.conf and it\\\’ll look like :

Raw

[root@server /]# cat /etc/idmapd.conf
[General]

Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = example.com

[Mapping]

Nobody-User = nfsnobody
Nobody-Group = nfsnobody

[Translation]
Method = nsswitch

3.4 Make the value of SECURE_NFS to yes in /etc/sysconfig/nfs. To enable secure NFS, you must add the following line to /etc/sysconfig/nfs :

Raw

SECURE_NFS=yes

After the restart the NFS servers, the environment is able to work properly using Kerberos authentication and RPCSEC_GSS.

Testing :

On client machine issue the following command to mount the exporting directory of the server :

Raw

# mount -t nfs4 -o sec=krb5 server.example.com:/ /mnt/my_nfs_mount_point

Now create the files inside the /data directory on the server and view the files inside /mnt directory on the client machine.

Note : NFS daemons looks like on the server :

Raw

[root@server /]# service nfs status
rpc.svcgssd (pid 8974) is running...
rpc.mountd (pid 8994) is running...
nfsd (pid 8991 8990 8989 8988 8987 8986 8985 8984) is running...
rpc.rquotad (pid 8979) is running...

根源

By default NFS clients and servers use the AUTH_SYS protocol to authenticate users.
AUTH_SYS is defined in RPC v2 (http://www.ietf.org/rfc/rfc1831.txt) to allocate a 4 bit value to group memberships, hence the 16 groups limitation.
But since v4, NFS can use a different authentication protocol such as RPCSEC_GSS which supports more groups.

診斷步驟

The following considerations can help to debug problems with the above setup.

Are hosts properly resolved via DNS or /etc/hosts?

Are the expected principals in the keytab? This can be verified with klist -ke.

Are the required services running on client and server?

Have the services been restarted?

Are the required modules loaded? In some cases rpcsec_gss_krb5 was not loaded automatically on RHEL5.

Is showmount -e <server> from the client showing the exports?

It might be useful to configure rpc.gssd for more verbosity, set RPCGSSDARGS=-vvv in /etc/sysconfig/nfs and restart the service.

For nfs debugging execute echo 32767 > /proc/sys/sunrpc/nfs_debug.

更多關于云服務器,域名注冊,虛擬主機的問題,請訪問三五互聯官網:m.shinetop.cn

贊(0)
聲明:本網站發布的內容(圖片、視頻和文字)以原創、轉載和分享網絡內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。郵箱:3140448839@qq.com。本站原創內容未經允許不得轉載,或轉載時需注明出處:三五互聯知識庫 » 【LINUX】怎樣配置 NFSv4 with kerberos 自動認證

登錄

找回密碼

注冊