Chinaunix首页 | 论坛 | 博客
  • 博客访问: 610925
  • 博文数量: 244
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 130
  • 用 户 组: 普通用户
  • 注册时间: 2016-06-27 09:53
个人简介

记录学习,记录成长

文章分类

全部博文(244)

我的朋友

分类: LINUX

2015-09-20 22:48:18

1.  卸载原有samba安装新版的samba
[root@www ~]# yum install samba4.i686 samba4-client.i686 samba4-common.i686 
2.  创建共享目录
[root@www ~]# mkdir /share/test -pv
mkdir: created directory `/share'
mkdir: created directory `/share/test'
3.  编辑samba配置文件添加共享为tools
[tools]
        comment = share test
        path = /share/test
        public = yes
        writable =yes
4.  测试语法并启动服务
[root@www samba]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[tools]"
Loaded services file OK.
ERROR: cache directory /var/cache/samba does not exist
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[root@www samba]# service smb start
Starting SMB services: [  OK  ]
[root@www samba]# netstat -ntlp 
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      11283/smbd
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      11283/smbd
5.  创建用户帐号
[root@www samba]# useradd user1
[root@www samba]# passwd user1 #密码为redhat
此时user1只是系统帐号,还需将其添加为samba的帐号,使其不在使用user1的系统帐号密码,因为,虽然登录samba的用户是系统用户,但是其密码不是系统用户的密码而是另外设置的samba密码;
[root@www samba]# smbpasswd -a user1
New SMB password: #密码为123456
Retype new SMB password:
Added user user1.
6.  测试
打开我的电脑,在地址栏使用UNC路径输入 \\192.168.85.128显示192.168.85.128的所有共享

在其中新建一个文本文档

登录到user1用户查看文件
[root@www ~]# su - user1
[user1@www ~]$ ll /home/user1/
-rwxr--r-- 1 user1 user1 0 Sep 19 20:31 test.txt.txt
对于tools目录虽然定义了有写权限但是

这是因为user1用户对文件本身无写权限
[root@www ~]# ll -d /share/test/
drwxr-xr-x 2 root root 4096 Sep 19 20:05 /share/test/
设置user1用户对文件本身有写权限:
[root@www ~]# setfacl -m u:user1:rwx /share/test/
再次测试:

7.  将共享目录映射为本地驱动器:
右键我的电脑,选择映射网络驱动器

然后打开我的电脑

伺候就可以直接打开使用了;
阅读(1133) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~