NFS实例 rhel 7

NFS实例 rhel 7

1.在server0上,要求共享目录/nfstest,允许网络上任何主机都能以只读的方式访问目标服务器,在server0上,共享目录/nfsprivate,仅允许example.com域可以访问,域内主机拥有读写功能,并且使用kerboers安全认证。验证所用文件使用http://classroom.example.com/pub/keytabs/server0.keytab.

2.Desktop0上使用krb5p来至server0上nfs共享/nfsprivate目录的共享进行安全认证,验证所用文件使用http://classroom.example.com/pub/keytabs/desktop0.keytab.要求每次开机都能自动挂载。

服务器:

[root@server0 ~]# lab nfskrb5 setup

Installing packages ...

Updating authconfig for ldap & krb5 ...

SUCCESS

[root@server0 ~]#

[root@server0 ~]# firefox

[root@server0 ~]# yum -y install nfs*

[root@server0 ~]# cd /

[root@server0 /]# mkdir abc

[root@server0 /]# mkdir krb5

[root@server0 /]# chmod 777 abc krb5

[root@server0 /]# vim /etc/exports

/abc 172.25.0.0/24(ro)

/krb5 172.25.0.0/24(sec=krb5p,rw)

[root@server0 /]# exportfs -rv

exporting 172.25.0.0/24:/krb5

exporting 172.25.0.0/24:/abc

[root@server0 /]# systemctl enable nfs-secure-server

[root@server0 /]# systemctl start nfs-secure-server

[root@server0 /]# systemctl enable nfs-server

[root@server0 /]# systemctl start nfs-server

[root@server0 /]# systemctl start rpcbind

[root@server0 /]# systemctl enable rpcbind

[root@server0 /]# firewall-cmd --permanent --add-service=nfs

success

[root@server0 /]# firewall-cmd --reload

success

[root@server0 /]# showmount -e localhost

Export list for localhost:

/krb5 172.25.0.0/24

/abc 172.25.0.0/24

[root@server0 /]#

客户端

[root@desktop0 ~]# lab nfskrb5 setup

Installing packages ...

Updating authconfig for ldap & krb5 ...

SUCCESS

[root@desktop0 ~]#

[root@desktop0 ~]# yum -y install nfs*

[root@desktop0 ~]# firefox

下载desktop0的kerb5.kerborkey

[root@desktop0 ~]# systemctl start nfs-secure

[root@desktop0 ~]# mkdir /mnt/abc

[root@desktop0 ~]# mkdir /mnt/krb5

[root@desktop0 ~]# mount -t nfs server0:/abc /mnt/abc

[root@desktop0 ~]# mount -o sec=krb5p server0:/krb5 /mnt/krb5/

[root@desktop0 ~]# df -TH

Filesystem Type Size Used Avail Use% Mounted on

/dev/vda1 xfs 11G 3.5G 7.3G 33% /

devtmpfs devtmpfs 950M 0 950M 0% /dev

tmpfs tmpfs 966M 82k 966M 1% /dev/shm

tmpfs tmpfs 966M 18M 948M 2% /run

tmpfs tmpfs 966M 0 966M 0% /sys/fs/cgroup

server0:/abc nfs4 11G 3.5G 7.3G 33% /mnt/abc

server0:/krb5 nfs4 11G 3.5G 7.3G 33% /mnt/krb5

[root@desktop0 ~]# cd /mnt/krb5/

[root@desktop0 krb5]# touch kr

[root@desktop0 krb5]# ll

total 0

-rw-r--r--. 1 nfsnobody nfsnobody 0 Oct 3 23:19 kr

[root@desktop0 krb5]# cd /mnt/abc/

[root@desktop0 abc]# touch a

touch: cannot touch 'a': Read-only file system

[root@desktop0 abc]# ll

total 0

[root@desktop0 abc]#

vim etc/fstab

server0:/krb5 /mnt/krb5 nfs sec=krb5p,defaults 0 0

[root@desktop0 /]# reboot

Connection to desktop0 closed by remote host.

Connection to desktop0 closed.

[root@foundation0 Desktop]# ssh -X root@desktop0

Last login: Sat Oct 3 23:09:31 2015 from 172.25.0.250

(process:1691): dconf-WARNING **: failed to commit changes to dconf: Could not connect: Connection refused

[root@desktop0 ~]# df -TH

Filesystem Type Size Used Avail Use% Mounted on

/dev/vda1 xfs 11G 3.5G 7.3G 33% /

devtmpfs devtmpfs 950M 0 950M 0% /dev

tmpfs tmpfs 966M 82k 966M 1% /dev/shm

tmpfs tmpfs 966M 18M 948M 2% /run

tmpfs tmpfs 966M 0 966M 0% /sys/fs/cgroup

server0:/krb5 nfs4 11G 3.5G 7.3G 33% /mnt/krb5

你可能感兴趣的:(网络,style,服务器,color,软装设计)