Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1344375
  • 博文数量: 145
  • 博客积分: 1440
  • 博客等级: 少尉
  • 技术积分: 2986
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-24 23:47
个人简介

我一直在走,至少还有条路,也好于无路可走…

文章分类

全部博文(145)

文章存档

2023年(1)

2017年(2)

2016年(5)

2015年(13)

2014年(13)

2013年(70)

2012年(41)

分类: LINUX

2013-08-08 11:37:56

编写一个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
阅读(2270) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~