题目:
编写一个nfs,要求允许192.168.5.0网段针对/myshare权限为rwx
在此目录下创建test1.txt 要求权限为400
#!/bin/bash
##guying
yum install nfs* -y
sed -i 's/BOOTPROTO=dhcp/BOOTPROTO=static/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/BOOTPROTO="dhcp"/BOOTPROTO=static/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/BOOTPROTO=none/BOOTPROTO=static/g' /etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR=192.168.5.22" >>/etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK=255.255.255.0" >>/etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
mkdir /myshare
echo '/myshare 192.168.5.0/24(rw,sync,no_root_squash,all_squash)' >/etc/exports
chmod 777 /myshare -R
/etc/init.d/rpcbind restart
/etc/init.d/nfs restart
if [ $? == "0" ];then
umount /mnt
mount -t nfs 192.168.5.22:/myshare /mnt
fi
echo "Please waiting"
echo "hello word" > /mnt/test1.txt
chmod 400 /mnt/test1.txt
echo "create successful"
阅读(1610) | 评论(0) | 转发(0) |