nfs服务器

1.开放/nfs/shared目录,供所有用户查阅资料

  • 在服务端和客户端安装nfs-utils
cs 复制代码
[root@sever ~]# yum -y install nfs-utils
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.3.0-0.el7 will be installed
--> Processing Dependency: libtirpc >= 0.2.3-1 for package: 1:nfs-utils-1.3.0-0.el7.x86_64
--> Processing Dependency: keyutils for package: 1:nfs-utils-1.3.0-0.el7.x86_64
  • 启动
cs 复制代码
[root@sever ~]# systemctl restart rpcbind nfs-server

[root@client ~]# systemctl restart rpcbind nfs-server
  • 在服务器上创建/nfs/shared目录(供所有用户查阅资料)
cs 复制代码
[root@sever ~]# mkdir -p /nfs/shared
  • 修改/etc/exports文件
cs 复制代码
[root@sever ~]# cat /etc/exports
/nfs/shared *(ro)
  • 重启
cs 复制代码
[root@server ~]# exportfs -r
  • 在客户端查看服务器的共享目录
cs 复制代码
[root@client ~]# showmount -e 192.168.147.28
Export list for 192.168.147.28:
/nfs/shared *
  • 客户端将nfs共享的目录挂载到指定目录下
cs 复制代码
[root@client ~]# mount -t nfs 192.168.147.28:/nfs/shared /client
[root@client ~]# df -Th
  • 在服务器上创建文件或目录
cs 复制代码
[root@server ~]# cd /nfs/shared/
[root@server shared]# ls
[root@server shared]# mkdir aaa

2.开放/nfs/upload目录为x.x.x.0/24网段的数据上传目录,并将所有用户及所属的用户组都映射为nfs-upload,其UID与GID均为3000

  • 在服务端创建/nfs/upload目录,创建用户和组为nfs-upload,指定UID,GID为3000
cs 复制代码
[root@server ~]# mkdir /nfs/upload
[root@sever ~]# useradd -r -u 300 nfs-upload
[root@server ~]# id nfs-upload
uid=300(nfs-upload) gid=300(nfs-upload) groups=300(nfs-upload)
[root@server ~]# 
  • 修改/nfs/exports文件
cs 复制代码
[root@server ~]# vim /etc/exports
[root@server ~]# cat /etc/exports
/nfs/shared *(ro)
/nfs/upload 192.168.120.0/24(rw,anonuid=3000,anongid=3000)
[root@server ~]# exportfs -r
  • 在客户端查看nfs共享的目录
cs 复制代码
[root@client ~]# showmount -e 192.168.147.28
Export list for 192.168.147.28:
/nfs/shared *
/nfs/upload 192.168.147.0/24
  • 将共享目录属组改为nfs-upload
cs 复制代码
[root@server ~]# chown -R 3000 /nfs/upload/
[root@server ~]# chgrp -R 3000 /nfs/upload/
[root@server ~]# ll /nfs/

3.配置ssh免密登陆,能够通过客户端主机通过redhat用户和服务端主机基于公钥验证方式进行远程连接server端创建用户redhat,切换用户为redhat,并制作公钥。

  • 在服务器端创建用户,制作公钥
  • 创建密钥
  • 测试是否可以进行免密登录

---------------------------------------------------END-------------------------------------------------------

相关推荐
程序员老舅1 分钟前
C++高并发精髓:无锁队列深度解析
linux·c++·内存管理·c/c++·原子操作·无锁队列
雨中风华14 分钟前
Linux, macOS系统实现远程目录访问(等同于windows平台xFsRedir软件的目录重定向)
linux·windows·macos
Yeats_Liao22 分钟前
评估体系构建:基于自动化指标与人工打分的双重验证
运维·人工智能·深度学习·算法·机器学习·自动化
爱吃生蚝的于勒42 分钟前
【Linux】进程信号之捕捉(三)
linux·运维·服务器·c语言·数据结构·c++·学习
The森1 小时前
Linux IO 模型纵深解析 01:从 Unix 传统到 Linux 内核的 IO 第一性原理
linux·服务器·c语言·经验分享·笔记·unix
文艺理科生Owen1 小时前
Nginx 路径映射深度解析:从本地开发到生产交付的底层哲学
运维·nginx
期待のcode1 小时前
Redis的主从复制与集群
运维·服务器·redis
翼龙云_cloud1 小时前
腾讯云代理商: Linux 云服务器搭建 FTP 服务指南
linux·服务器·腾讯云
纤纡.1 小时前
Linux中SQL 从基础到进阶:五大分类详解与表结构操作(ALTER/DROP)全攻略
linux·数据库·sql
好好学习天天向上~~2 小时前
6_Linux学习总结_自动化构建
linux·学习·自动化