Linux Samba 搭建
匿名服务:
1. 检查linux上防火墙设置
setup
SElinux disable
Samba enable
重启防火墙:/etc/init.d/iptables restart
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
cd /etc/samba
cp smb.conf smb.conf.bak
vim smb.conf
启用日志:
log file = /var/log/samba/%m.log
max log size = 50
log file = /var/log/samba/%m.log
max log size = 50
[share]
comment = share
path = /home/share
public = yes
重启samba服务:service smb restart
comment = share
path = /home/share
public = yes
重启samba服务:service smb restart
3. 建共享目录
cd /home
mkdir share
cd /home
mkdir share
4. 修改主机名 vi /etc/sysconfig/network
HOSTNAME=主机名
重启网络服务 service network restart
HOSTNAME=主机名
重启网络服务 service network restart
5. 测试:
查看:smbclient -L LinuxIP地址
使用:smbclient //LinuxIP地址/share
查看:smbclient -L LinuxIP地址
使用:smbclient //LinuxIP地址/share
6. windows客户端
打开:"网上邻居"/查看工作组计算机
打开:"网上邻居"/查看工作组计算机
用户密码方式:1. 修改smb.conf文件
cd /etc/samba
cp smb.conf smb.conf.bak
vim 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
[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
cd /home
mkdir user
useradd test1
passwd test1
chown test1 /home/user
3. 查看samba服务相关用户
查看: pdbedit -L
创建:smbpasswd -a test1
查看: pdbedit -L
创建:smbpasswd -a test1
4.测试:
查看:smbclient -L LinuxIP地址 -U test1%密码
使用:smbclient //LinuxIP地址/user -U test1%密码
查看:smbclient -L LinuxIP地址 -U test1%密码
使用:smbclient //LinuxIP地址/user -U test1%密码
5. windows客户端
打开:"网上邻居"/查看工作组计算机
新建文件,文件夹
打开:"网上邻居"/查看工作组计算机
新建文件,文件夹
用户密码方式+多用户:1. 创建用户,组:
groupadd sales
groupadd market
groupadd sales
groupadd market
for user in tom jack
do
useradd -g sales $user
smbpasswd -a $user
done
do
useradd -g sales $user
smbpasswd -a $user
done
for user in zhang shen
do
useradd -g market $user
smbpasswd -a $user
done
do
useradd -g market $user
smbpasswd -a $user
done
useradd ceo
smbpasswd -a 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
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
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
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
Comments
Post a Comment