Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6548227
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: LINUX

2012-01-13 10:37:45

环境:Rad Hat Linux As 4
 
步骤1: 检查是否安装了sambe
[root@hxl ~]# rpm -qa|grep samba
samba-client-3.0.10-1.4E.9
samba-common-3.0.10-1.4E.9
samba-3.0.10-1.4E.9
若没有安装可以在linux 安装介质中找到vnc相关的软件包安装(这里安装步骤略过).
 
步骤2:配置smb.conf
[root@hxl ~]#vi /etc/samba/smb.conf
在[global]部分做如下修改:
1) workgroup = WORKGROUP #定义工作组
2) hosts allow = 192.168.30. #(写一个允许访问这服务器的网段,末尾有".")
3) security=user
4) encrypt passwdords=yes (去掉前面的注释";")
   smb passwd file = /etc/samba/smbpasswd  (密码文件的位置,去掉前面的注释";")
5) 在文件末尾添加如下内容:
[samba]    #(共享文件夹名)
comment=This is my samba server  #这是注释行,可以不写东西
path=/samba    #指定要共享文件的位置
writable = yes         
browseable =yes
read only = yes      #只读权限
create mode=0664     #这是文件权限
directory mode=0777  #这是目录权限

samba有四种安全等级:
share:用户不需要账户及密码即可登录samba服务器
user:由提供服务的samba服务器负责检查账户及密码(默认)
server:检查账户及密码的工作由另一台windows或samba服务器负责
domain:指定windows域控制服务器来验证用户的账户及密码
 
步骤3:启动smb服务
[root@hxl ~]# service smb start
Starting SMB services:                                     [  OK  ]
Starting NMB services:                                     [  OK  ]
[root@hxl ~]# testparm #检查相应配置
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[samba]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
 
步骤4.创建samba用户
1)建一个系统用户
[root@hxl ~]# useradd samba
[root@hxl ~]# passwd samba
Changing password for user samba.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
2)然后创建samba帐户
[root@hxl ~]# smbpasswd -a samba
New SMB password:
Retype new SMB password:
Added user samba.
#-a必须加,为了生成密码文件smbpasswd,该密码是windows登陆Linux的samba用户密码
4)重新启动samba服务
[root@hxl ~]# service smb restart
Shutting down SMB services:                                [  OK  ]
Shutting down NMB services:                                [  OK  ]
Starting SMB services:                                     [  OK  ]
Starting NMB services:                                     [  OK  ]
 
步骤5:测试
1)先按照主配置文件所指定的位置,建好要共享的资源.
[root@hxl ~]# mkdir samba       #在root根目录创建建/samba文件夹
[root@hxl ~]# chmod 777 /samba  #设置权限
[root@hxl ~]# cd samba
[root@hxl ~]# vi test.txt
 
在Windows客户机的地址栏中输入samba服务器ip (如\\192.168.30.33)
 
 
 
-- 配置完成---
 
备注:
sambe共享目录权限设置举例
1). #用户对samba目录只有读取的权限
[samba]
comment=This is my samba server
path=/samba
writable = no
browseable =yes
read only = yes
create mode=0664
directory mode=0777
2).#用户对samba目录只有读取的权限
[samba]
comment=This is my samba server
path=/samba
writable = yes #这里设置了yes但read only设置成了yes,对该目录也只有读取权限
browseable =yes
read only = yes
create mode=0664
directory mode=0777

3).#用户对samba目录有写入的权限
[samba]
comment=This is my samba server
path=/samba
writable = yes
browseable =yes
read only = no
create mode=0664
directory mode=0777
阅读(3335) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~