`
yangzhiyong77
  • 浏览: 972388 次
文章分类
社区版块
存档分类
最新评论

编译安装samba 3.3.3

 
阅读更多

----------------------------
第一部分:编译安装
----------------------------


1.解压

# tar xvzf samba-3.3.3.tar.gz

2.配置

#cd cd /test/samba-3.3.3/source/ --test为保存samba压缩文件的目录

#./configure --prefix=/usr/local/samba --with-acl-support


By default, `make install' will install all the files in
`/usr/local/samba/bin', `/usr/local/samba/lib'

3.编译

#make

4.安装

#make install

默认将samba安装到/usr/local/samba中。


5.复制samba配置文件样例到//usr/local/samba/lib下

# pwd
/test/samba-3.3.3/examples

# cp smb.conf.default /usr/local/samba/lib/smb.conf

6.新建需要的目录
#mkdir /etc/samba


7.链接smb配置文件
#ln -s /usr/local/samba/lib/smb.conf /etc/samba

8.建议备份smb.conf配置文件
#mkdir /backup
#cp /usr/local/samba/lib/smb.conf /backup


----------------------------------------------------------------------
第二部分:实验配置
----------------------------------------------------------------------

【案例说明】

1、所有员工都能够在公司内流动办公,但不管在哪台电脑上工作,都要把自己的文件数据保存在samba文件服务器上。
2、市场部,技术部都各有自己的目录,同一个部门的人共同拥有一个共享目录,其他部门的人都只能访问在服务器上自己个人的home目录。
3、所有用户都不允许使用服务器上的shell。


【案例分析】
1、需要samba作为文件服务器,为所有用户创建账号和目录,用户默认都在服务器上有一个home目录,只有认证通过才能看到。
2、需为市场部和技术部创建不同的组sales和tech,并且分配目录,把所有市场部员工加入sales组,技术部员工加入tech组,通过samba共享sales和tech
3、建立用户账号时,不分配shell

(1).编辑smb.conf,设置安全级别为user级别。默认情况下就是user安全级别


security = user
smb passwd file=/etc/samba/smbpasswd


(2)建立市场部sales和技术部tech的组与用户,并加入用户到相应组,禁止登陆shell

#groupadd sales
#groupadd tech
#useradd -g sales -s /bin/false wind
#useradd -g sales -s /bin/false snow
#useradd -g tech -s /bin/false mary
#useradd -g tech -s /bin/false tiger


(3)新建ITG组和用户,并加入到对应的组,禁止登陆shell

#groupadd ITG
#useradd -g ITG -s /bin/false scott
#useradd -g ITG -s /bin/false silver

(4)批量添加用户为samba用户,并设置密码。这里默认为123
#cd /usr/local/samba
#for user in wind snow mary tiger scott silver
do
smbpasswd -a $user
done


New SMB password:
Retype new SMB password:
startsmbfilepwent_internal: file /etc/samba/smbpasswd did not exist. File successfully created.
Added user wind.
New SMB password:
Retype new SMB password:
Added user snow.
New SMB password:
Retype new SMB password:
Added user mary.
New SMB password:
Retype new SMB password:
Added user tiger.
New SMB password:
Retype new SMB password:
Added user scott.
New SMB password:
Retype new SMB password:
Added user silver.


(5)建立组共享文件夹并设置权限
#mkdir /home/sales /home/tech
#chgrp sales /home/sales
#chgrp tech /home/tech
#chmod 770 /home/sales
#chmod 770 /home/tech
#chmod g+s /home/sales
#chmod g+s /home/tech


(6)变价smb.conf,添加共享文件夹并做对应设置
#vi /etc/samba/smb.conf

[sales]
path=/home/sales
comment=sales
public=no
valid users=@sales
write list=@sales
create mask=0770
directory mask=0770


[tech]
path=/home/tech
comment=tech
public=no
valid users=@tech
write list=@tech
create mask=0770
directory mask=0770


(7)启动samba

#/usr/local/samba/sbin/nmbd -D
#/usr/local/samba/sbin/smbd -D

/***********************
常见错误:


/usr/local/samba/sbin/nmbd: error while loading shared libraries: libtalloc.so.1: cannot open shared object file: No such file or directory


# vi /etc/ld.so.conf
或则
#echo "/usr/local/samba/lib " >>/etc/ld.so.conf

在该文件后添加如下内容:
/usr/local/samba/lib

#ldconfig


*******************************/

(8)将samba添加到启动脚本,实现开机自动启动samba服务


#echo "/usr/local/samba/sbin/nmbd -D" >>/etc/rc.d/rc.local
#echo "/usr/local/samba/sbin/smbd -D" >>/etc/rc.d/rc.local

#cat /usr/local/samba/var/log.smbd
#cat /usr/local/samba/var/log.nmbd

[2009/04/09 12:50:55, 0] smbd/server.c:main(1267)
smbd version 3.3.3 started.
Copyright Andrew Tridgell and the Samba Team 1992-2009
[2009/04/09 12:50:55, 0] param/loadparm.c:lp_do_parameter(7230)
Global parameter smb passwd file found in service section!


(9)建立测试文件


# ls /home/sales/
# cat >/home/sales/s.txt
hello, welcome to sales public department!
# ls /home/tech/
# cat >/home/tech/t.txt
hello, here is tech location!


(10)只是允许某些IP能访问
hosts allow = 192.168.11.1 192.168.11.2

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics