编写一个shell要求如下:
创建三个用户分别为为
alins jim user1
配置samba服务,共享名为RHCA 路径为/share/rhca 在此目录下创建一个文件 权限为rwx
user1在此目录下创建文件 名称为ps1
当用户alins访问共享时 权限为只读
当用户为Jim访问共享时权限为读写且不可以删除user1创建的文件
执行前请保证有yum源
执行的时候,请给alins jim user1 统一设置密码为redhat执行脚本的时候会提示输入;
please input passwd for alins:
请输入:redhat
#!/bin/bash
##guying
ip=`ifconfig eth0 |grep 'inet addr' |awk -F '[ :]+' '{print $4}'`
useradd alins
useradd jim
useradd user1
mkdir /share/rhca -p
chmod 777 /share/rhca -R
setfacl -m u:alins:r-x /share/rhca/
chmod o+t /share/rhca -R
yum -y install samba samba-client
setenforce 0
echo "please input passwd for alins:"
smbpasswd -a alins
echo "please input passwd for jim:"
smbpasswd -a jim
echo "please input passwd for user1:s"
smbpasswd -a user1
echo "[RHCA]" >>/etc/samba/smb.conf
echo "path = /share/rhca" >>/etc/samba/smb.conf
echo "browseable = yes" >> /etc/samba/smb.conf
echo "writable = yes" >>/etc/samba/smb.conf
echo "write list = alins jim user1 " >>/etc/samba/smb.cof
service smb restart
echo "//$ip/RHCA /mnt cifs username=user1,password=redhat 0 0 " >>/etc/fstab
mount -a
touch /mnt/ps1
iptables -F
阅读(2367) | 评论(0) | 转发(0) |