云计算作业

发布于:2024-11-03 ⋅ 阅读:(193) ⋅ 点赞:(0)

[root@localhost ~]# systemctl stop  firewalld       #关闭防火墙

[root@localhost ~]# setenforce 0                       #关闭linux

[root@localhost ~]# vim /etc/exports                #打开配置文件

/nfs/shared *(ro)                                         

/nfs/upload 192.168.208.0/24(rw,anonuid=210,anongid=210) #开放/nfs/upload目录,为192.168.208.0/24网段主机可以上传目录,将所有用户及所属的组映射为nfs-upload,其UID和GID均为210

[root@localhost ~]# useradd -u 210 nfs-upload      #创建用户nfs-upload

[root@localhost ~]# groupmod -g 210 nfs-upload    #UID和GID均为210

[root@localhost ~]# chmod o+w /nfs/upload   #服务端开启对其他用户的写权限

/home/tom 192.168.208.129(rw)        #将/home/tom目录仅共享给192.168.208.129这台主机,并只有用户tom对该目录有读写权限

[root@localhost ~]# useradd tom        #创建tom用户

[root@localhost ~]# id tom            #查看tom用户id

[root@localhost ~]# systemctl restart nfs-server      #重启服务

[root@localhost ~]# exportfs -ra             #加载新的配置内容信息

[root@localhost ~]# showmount -e 192.168.208.100           #查看可挂载文件

[root@localhost t]# mount 192.168.208.100:/nfs/shared /s         # 挂载/nfs/shared

[root@localhost t]# mount 192.168.208.100:/nfs/upload /n              #挂载/nfs/upload

[root@localhost ~]# mount 192.168.208.100:/home/tom /t          #挂载/home/tom

[root@localhost ~]# vim  /etc/fstab            #自动挂载

[root@localhost ~]# cat /etc/fstab           #查看

在配置文件下添加如下指令

############################
文件系统名称                    挂载目录    格式化类型  默认参数       开机是否备份 开机是否检查
192.168.205.100:/home/tom       /t      nfs4     defaults,sync   0 0
/dev/sr0                        /mnt     iso9660 defaults  0 0

reboot                         #重启虚拟机


网站公告

今日签到

点亮在社区的每一天
去签到