2010年(27)
分类: LINUX
2010-03-29 17:34:23
一 配置服务器流程如下
二 配置服务器过程
首先查找samba的守护进程是否存在,若不存在,则安装samba软件(当然,前提是在某文件夹下存放了samba的安装软件,在这里将安装软件samba-
在后面还给了一个简单的用以更新samba服务器配置的脚本。
#!/bin/bash
echo "set samba server for sharing document with Widows in local net"
smbserverfolder=/etc/init.d
#./smb
smbexefolder=/usr/sbin/
#./smbd ./nmbd
smbfolder=/etc/samba
smb=/etc/samba/smb.conf
#Samba have two server --- smbd nmbd
if [ -r $smbfoler ] && [ -f $smb ] ; then
echo "samba server has been installed, and will be opened"
else
echo "can't read $smbfolder or samba don't exist"
echo "install samba server ....."
#
#install samba server step...
#
smbdir=samba-
smbfile="$smbdir.tar.gz"
cp "./$smbfile" /tmp
cd /tmp
tar -zxvf "/tmp/$smbfile"
cd "./$smbdir/source"
./configure
make clean
make install
fi
echo "clear iptables rules....."
/sbin/iptables -F
echo "open samba server......"
#pgrep smbd -- pkill smbd ;pgrep nmbd -- pkill nmbd
/usr/sbin/smbd
/usr/sbin/nmbd
if [ -f "./smb.confshare" ];then
echo "add share folder... and update samba setting ... "
./smb.confshare
else
echo "no script to add sharefolder , please manually add "
fi
#查找是否有用以挂载samba服务器的脚本,若有则执行
if [ -f "./smb.mounthosts" ];then
echo "mount all honts in this local net"
./smb.mounthosts
else
echo "no script to
fi
-------------------------------------------------------------------
#!/bin/bash
smbfolder=/etc/samba
smbconf=smb.conf
sharefolder=/home/sharedoc
echo "++++++++++++++++build share directory+++++++++++++++"
echo "/home/sharedoc"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
#build a share doc in own host
if ( ! [ -d "$sharefolder" ]);then mkdir "$sharefolder" ; fi
id nobody
chown -R nobody:nobody "$sharefolder"
#set configure in samba for sharing directory
if [ -r "$smbfolder" ]; then
cd "$smbfolder"
mv "$smbconf" smbOLD.conf
cat > $smbconf << "EOF"
#++++++++++++write grant to smb.conf++++++++++++
[global]
workgroup = LinuxSir
server string = linux samba server
security = share
[linuxsharedoc]
path =$sharefolder
browseable = yes
guest ok = yes
writeable = yes
EOF