Linux中samba服务器配置

注意:如果配置过程中出现不正常现象请看文档末尾处的注意事项。

1、将samba所需要的rpm安装包(已提供)上传linux服务器至:/usr/local/soft/

2、执行操作命令:

a、cd /usr/local/soft

b、rpm -ivh samba-3.6.12-59.2.1.x86_64.rpm

c、rpm -ivh samba-client-3.6.12-59.2.1.x86_64.rpm

3、添加自启动

执行命令:chkconfig –a smb

4、开启防火墙例外

vim /etc/sysconfig/SuSEfirewall2

使用查找命令:

分别查找

FW_SERVICES_EXT_TCP和FW_SERVICES_EXT_UDP

a、在FW_SERVICES_EXT_TCP 处添加上:139、389、445、901

b、在FW_SERVICES_EXT_UDP 处添加上:137、138

5、重启防火墙

SuSEfirewall2 stop

SuSEfirewall2 start

6、建立samba服务器目录文件:

a、执行命令:

cd /home

mkdir dl_data

chmod 555 dl_data

b、 建立各个单位的文件目录:执行命令

cd /home/dl_data

如1:大连供电车间

mkdir大连供电车间

chmod –R 777大连供电车间

如1:高铁技术科

mkdir大连供电车间

chmod –R 777高铁技术科

依上述所说:目录结构如下

权限 目录

dr-xr-xr-x –dl_data

drwxrwxrwx | –大连供电车间

drwxrwxrwx | –高铁技术科

7、添加samba用户

用户1:

添加用户:useradd user1

设置密码:passwd user1

添加user1到samba用户:smbpasswd -a user1(注意:此时需要设置samba用户密码,也是samba登录密码)

8、配置samba配置文件:

执行命令:vim /etc/samba/smb.conf (最好先备份一下,备份命令 cp /etc/samba/smb.conf /etc/samba/smb.confcopy)

除了一下这段话,其余的全部用#号注释掉。

[global]

workgroup = WORKGROUP

passdb backend = tdbsam

printing = cups

printcap name = cups

printcap cache time = 750

cups options = raw

map to guest = Bad User

include = /etc/samba/dhcp.conf

logon path = \%L\profiles.msprofile

logon home = \%L\%U.9xprofile

logon drive = P:

usershare allow guests = Yes

添加共享文件

[高铁技术科]

comment = public

path = /home/dl_data

valid users = keshi

writable = yes

create mask = 0777

[大连供电车间]

comment = public

path = /home/dl_data/大连供电车间

valid users = shop1

writable = yes

create mask = 0777

解释:

path = /home/dl_data/大连供电车间 : 表示共享文件路径

valid users = shop1:表示只允许shop1用户登录

writable = yes : 表示可写

注意事项:

安装时注意samba版本是否对应操作系统版本。

查看系统版本,如下

执行命令:lsb_release –a

rpm包下载地址:http://rpmfind.net/linux/rpm2html/

目录文件权限设置。

目录文件所有者、所有组设置

防火墙设置

目录是否和配置中的目录对应

smb用户密码是否正确(非系统用户)

自启动别忘了开启(否则下一次开机samba服务就未开启)
原文来自:http://www.aile.pub/295 欢迎访问博主的窝心网

猜你喜欢

转载自blog.51cto.com/6706782/2125619