nfs
来源:互联网 发布:sqlserver 回滚 编辑:程序博客网 时间:2024/06/05 16:10
nfs
NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源。在NFS的应用中,本地NFS的客户端应用可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样。
1.安装
yum install nfs-utils -y
systemctl enable nfs-server.service ##开机启动
systemctl start nfs-server.service ##开启服务
systemctl restart firewalld.service ##开启防火墙
firewall-cmd –permanent –add-service=nfs ##添加nfs
firewall-cmd –permanent –add-service=rpc-bind ##开启端口
firewall-cmd –permanent –add-service=mountd ##开启挂载服务
firewall-cmd –reload ##重新加载
测试:
[root@foundation41 ~]# showmount -e 172.25.254.133
Export list for 172.25.254.133:
2.共享目录
systemctl start nfs-server
mkdir /public
vim /etc/exports ##编辑共享文件
/public *(sync) ##public共享给所有人并且数据同步
/public 172.25.41.0/24(sync) ##public共享给172.25.41.0/24网段
/public *.example.com(sync) ##public共享给example.com域的所有主机
/public 172.25.254.60(ro,sync) 172.25.60.11(rw,sync) ##public共享给主机60只读,主机11读写
/public *(sync,no_root_squash) ##public共享给所有人,当客户端使用root挂载不转换用户身份
/public *(sync,anonuid=1001,anongid=1000) ##public共享给所有人,以uid为1001,gid为1000
exportfs -rv ##刷新
3.利用kerberos保护nfs输出
server:
IPADDR=172.25.41.10
NETMASK=255.255.255.0
GATEWAY=172.25.41.254
DNS=172.25.254.254
desktop:
IPADDR=172.25.41.11
NETMASK=255.255.255.0
GATEWAY=172.25.41.254
DNS=172.25.254.254
在server上(server端)
yum install sssd krb5-workstation.x86_64 authconfig-gtk.x86_64 -y
开启kerberos认证,得到ldap用户
authconfig-gtk
wget http://172.25.254.254/pub/keytabs/server41.keytab -O /etc/krb5.keytab
ktutil ##检测是否得到证书
ktutil: rkt /etc/krb5.keytab
ktutil: list
[root@server41 ~]# systemctl start nfs-secure-server ##开启服务
[root@server41 ~]# systemctl enable nfs-secure-server ##开机启动
vim /etc/exports ##编辑共享文件
/public *(rw,sec=krb5p)
exportfs -rv ##刷新
在desktop上(client端)
yum install sssd krb5-workstation.x86_64 authconfig-gtk.x86_64 -y
开启kerberos认证,得到ldap用户
authconfig-gtk
wget http://172.25.254.254/pub/keytabs/desktop41.keytab -O /etc/krb5.keytab
ktutil
ktutil: rkt /etc/krb5.keytab
ktutil: list
systemctl start nfs-secure
systemctl enable nfs-secure
vim /etc/hosts
server41.example.com 172.25.41.10
*)测试
[root@desktop41 ~]# mount 172.25.41.10:/public /mnt -o sec=krb5p
[root@desktop41 ~]# cd /mnt/
[root@desktop41 mnt]# ls
fileqqq
[root@desktop41 mnt]# touch haha
[root@desktop41 mnt]# cd
[root@desktop41 ~]# su - student
[student@desktop41 ~]
Password:
-bash-4.2
fileqqq haha
-bash-4.2
filedd fileqqq haha
- NFS
- NFS
- nfs
- NFS
- NFS
- nfs
- NFS
- NFS
- NFS
- nfs
- NFS
- NFS
- nfs
- nfs
- nfs
- NFS
- nfs
- NFS
- redis五种数据类型的增删改查语法
- ios11 下载地址
- Spark2.x 快速入门教程 1
- CentOS-6.9 开启SSH远程连接
- 【整理】Python 单元测试框架
- nfs
- leetcode 416. Partition Equal Subset Sum
- BZOJ4300[绝世好题]题解--DP
- Spark2.x 快速入门教程 2
- 基于像素分析的连连看辅助程序学习
- Spring in Action(八):Spring中使用JDBC
- Overfencing 穿越栅栏
- 锋利的jQuery读书笔记-第6章 jQuery与Ajax的应用
- Spark2.x 快速入门教程 3