为了让Linux服务器上的用户通过Windows访问他们在Linux服务器上的HOME目录,以及其他目录。
0、openSUSE11.4的用户需要关闭Novoll AppArmor,或更新/etc/apparmor.d/下关于samba的配置:
/etc/apparmor.d/usr.sbin.nmbd:
# Last Modified: Sun Feb 20 21:14:20 2011
#include <tunables/global>/usr/sbin/nmbd {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/samba>capability net_bind_service,
/usr/sbin/nmbd mr,
/var/cache/samba/browse.dat* rw,
/var/lib/samba/browse.dat rw,
/var/lib/samba/browse.dat. w,
/var/lib/samba/wins.dat* rw,
/var/log/samba/cores/ w,
/var/log/samba/cores/nmbd/ rw,
/var/log/samba/cores/nmbd/** rw,
/var/run/samba/** rk,
/var/run/samba/nmbd.pid rw,
/etc/apparmor.d/usr.sbin.smbd:
# Last Modified: Sun Feb 20 21:14:20 2011
#include <tunables/global>/usr/sbin/smbd flags=(complain) {
#include <abstractions/authentication>
#include <abstractions/base>
#include <abstractions/consoles>
#include <abstractions/cups-client>
#include <abstractions/nameservice>
#include <abstractions/samba>
#include <abstractions/user-tmp>
#include <abstractions/wutmp>capability net_bind_service,
capability setgid,
capability setuid,
capability sys_resource,
capability sys_tty_config,
/etc/mtab r,
/etc/printcap r,
/etc/samba/passdb.tdb rwk,
/etc/samba/secrets.tdb rwk,
/proc/*/mounts r,
/usr/sbin/smbd mr,
/var/cache/samba/** rwk,
/var/cache/samba/printing/printers.tdb mrw,
/var/lib/samba/** rwk,
/var/lib/samba/printers/** rw,
/var/log/samba/cores/smbd/ rw,
/var/log/samba/cores/smbd/** rw,
/var/run/cups/cups.sock rw,
/var/run/dbus/system_bus_socket rw,
/var/run/samba/** rk,
/var/run/samba/smbd.pid rw,
/var/spool/samba/** rw,
@{HOMEDIRS}/** rwlk,}
1、安装Samba服务
确保你安装了一下软件:
2、添加samba用户:
smbpasswd -a sahu
注:sahu同时合法Linux用户
3、配置samba服务[/etc/samba/smb.conf]
[global]
workgroup = WORKGROUP
passdb backend = tdbsam
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
map to guest = Bad User
logon path = //%L/profiles/.msprofile
logon home = //%L/%U/.9xprofile
logon drive = P:
security = domain
netbios name = susu
wins support = Yes
idmap gid = 100-200
idmap uid = 1000-2000
usershare allow guests = No
ldap suffix =
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
4、启动samba服务
service nmb start; service smb start
5、在windows中输入用户名和密码访问
99、清除windows中保持的用户名和密码[重新连接]
C:/Users/sahu>net use * /del /y