ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux Samba 搭建

Linux Samba 搭建

原创 Linux操作系统 作者:tomshenhao 时间:2011-10-25 10:29:42 0 删除 编辑

Linux 服务器端 + windows 客户端

匿名服务:
1. 检查linux上防火墙设置
setup
SElinux disable
Samba enable
重启防火墙:/etc/init.d/iptables restart

2. 修改smb.conf文件
cd /etc/samba
cp smb.conf smb.conf.bak
vim smb.conf

启用日志:
log file = /var/log/samba/%m.log
max log size = 50

workgroup = windows同名
server string = RHEL5 SAMBA SERVICE
security = share

[share]
comment = share
path = /home/share
public = yes
重启samba服务:service smb restart

3. 建共享目录
cd /home
mkdir share

4. 修改主机名 vi /etc/sysconfig/network
HOSTNAME=主机名
重启网络服务 service network restart

5. 测试:
查看:smbclient -L LinuxIP地址
使用:smbclient //LinuxIP地址/share

6. windows客户端
打开:"网上邻居"/查看工作组计算机

用户密码方式:
1. 修改smb.conf文件
cd /etc/samba
cp smb.conf smb.conf.bak
vim smb.conf

security = user
[user]
comment = user
path = /home/user
valid users = test1
writable = yes
重启samba服务:service smb restart


2.创建目录
cd /home
mkdir user
useradd test1
passwd test1
chown test1 /home/user

3. 查看samba服务相关用户
查看: pdbedit -L
创建:smbpasswd -a test1

4.测试:
查看:smbclient -L LinuxIP地址 -U test1%密码
使用:smbclient //LinuxIP地址/share -U test1%密码

5. windows客户端
打开:"网上邻居"/查看工作组计算机
新建文件,文件夹

用户密码方式+多用户:
1. 创建用户,组:
groupadd sales
groupadd market
for user in tom jack
do
useradd -g sales $user
smbpasswd -a $user
done
for user in zhang shen
do
useradd -g market $user
smbpasswd -a $user
done
useradd ceo
smbpasswd -a ceo
 
2. 创建文件夹及属性
cd home
mkdir sales
mkdir market
chgrp sales sales
chgrp market market
chown ceo sales
chown ceo market
chmod 770 sales
chmod 770 market
 
3. 修改配置文件
vi /etc/samba/smb.conf
[sales]
comment = sales
path = /home/sales
valid users = @sales ceo
write list = @sales ceo
create mask = 770
directory mask = 770
[market]
comment = market
path = /home/market
valid users = @market ceo
write list = @market ceo
create mask = 770
directory mask = 770
重启服务:service smb restart
 
windows清空登录:net user * /delete
 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24751738/viewspace-709628/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-07-14

  • 博文量
    260
  • 访问量
    431310