郁闷死了,在虚拟机上折腾了好几天了,samba都没弄好,不知道是什么原因,一直不能访问,在linuxsir找了几篇文章,今天先记录下来,明天看看,重新调整一下,看看能不能解决
为公司做个文件服务器的手记:
_____________________________________________________________________________
公司环境:
若干个部门,人力,行政,市场,拓展等等
要求:
公司每个员工(使用公共帐号)都有对公司文件服务器只读的基本权限
每个部门经理或者相关负责人都有独立在文件服务器上自己部门所在目录有完全访问的权限,而对其他部门的工作目录只有只读的权限,有一个公共目录,任何人都有写和删除自己文件的权限,普通员工上传的文件任何人都可以删除,不保证其安全性,对于部门经理级或相关负责人上传的文件除了超级用户外,任何人都不能删除。
_____________________________________________________________________________
samba配置如下
1.smb.conf配置如下:
代码:
[global]
workgroup = Workgroup
server string = %h server (Samba %v)
; wins support = no
; wins server = w.x.y.z
dns proxy = no
; name resolve order = lmhosts host wins bcast
log file = /var/log/samba/log.%m
max log size = 1000
; syslog only = no
syslog = 0
panic action = /usr/share/samba/panic-action %d
; security = user
encrypt passwords = true
passdb backend = tdbsam guest
obey pam restrictions = yes
; guest account = nobody
invalid users = root
; unix password sync = no
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
; pam password change = no
; load printers = yes
; printing = bsd
; printcap name = /etc/printcap
; printing = cups
; printcap name = cups
; printer admin = @ntadmin
; preserve case = yes
; short preserve case = yes
; include = /home/samba/etc/smb.conf.%m
socket options = TCP_NODELAY
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &
; domain master = auto
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash
;[homes]
; comment = Home Directories
; browseable = no
; writable = no
; create mask = 0700
; directory mask = 0700
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; writable = no
; share modes = no
[printers]
comment = All Printers
browseable = no
path = /tmp
printable = yes
public = no
writable = no
create mode = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
; write list = root, @ntadmin
;[cdrom]
; comment = Samba server's CD-ROM
; writable = no
; locking = no
; path = /cdrom
; public = yes
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom
[Share]
comment = Samba Files server
path = /home/samba/
guest ok = yes
writable = yes
share modes = no
2.添加用户和组:
a.添加超级管理用户
useradd sipingal #超级用户
编辑/etc/passwd文件中
sipingal开始的行中第二个冒号好的数字改为0,类似下面的格式
sipingal:x:0:100::/home/sipingal:
smbpasswd -a sipingal
b.添加一般员工的公用帐号
useradd share
smbpasswd -a share
c.添加个部门经理帐号
useradd renli
useradd xingzheng
useradd shichang
useradd tuozhan
smbpasswd renli
smbpasswd xingzheng
smbpasswd shichang
smbpasswd tuozhan
d.添加
samba组
groupadd
samba
e.并将相关人员帐号加入组中
编辑/etc/group文件,在
samba开头的行中加入相关帐号,格式如下
samba:x:119:sipingal,renli,xingzheng,shichang,tuozhan
3.建立目录和设置相关权限,完成配置
在/home下建立
samba目录(以下所有目录均属于
samba组)
chown sipingal
samba/ #赋于
samba所有
chgrp
samba samba/ #使
samba目录属组为
samba
在
samba下建立1_renli,2_xingzheng等相关目录
chown 1_renli rensh
chgrp
samba 1_renli
chown 2_xingzheng
chgrp
samba 2_xingzheng
其余类同并将所有目录设置权限为755
chmod -R 755 /home/
samba
建立公共目录/home/
samba/share
chown sipingal /home/
samba/share
chgrp sipingal /home/
samba/share
chmod 1777 /home/
samba/share
到此一切顺利完成。