Linux搭建Samba共享服务器
2024-09-01 22:13:23
实验要求:
Samba文件共享服务配置与访问,配置访问用户以及相应权限。
Tips:创建共享目录/test和/share,并且分别在/test下创建文件tf1(只读)tf2(读写) 在/share 下创建文件pf1(只读)和pf2(读写)
1、挂载本地yum源
[root@localhost /]# mkdir /media/cdrom
[root@localhost /]# mount /dev/cdrom /media/cdrom/
[root@localhost /]# vim /etc/yum.repos.d/rhel-source.repo rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///media/cdrom
enabled=1
2、关闭Selinux 和 IPtables
[root@localhost /]# vim /etc/selinux/config //路径 [root@localhost /]# setenforce 0 //临时关闭Selinux
[root@localhost /]# /etc/init.d/iptables stop //关闭防火墙
3、安装samba服务
[root@localhost /]# yum install samba -y
4、创建共享用户
[root@localhost /]# smbpasswd -a smb [root@localhost /]# smbpasswd -a smb
5、修改配置文件
[root@localhost /]# vim /etc/samba/smb.conf
workgroup = WORKGROUP //Win需要修改为工作组
server string = Samba Server Version %v security = user //可以改为everyone
passdb backend = tdbsam [test]
path = /test
public = yes
writeable = yes
valid users = smb [share]
path = /share
public = yes
writeable = yes
valid users = smb
6、创建本地共享目录和文件权限
[root@localhost /]# mkdir /test /share
[root@localhost /]# chown -R smb.smb /test/ /share/
[root@localhost test]# touch tp1 tp2
[root@localhost test]# chmod 444 tp1
[root@localhost test]# chmod 666 tp2 [root@localhost test]# echo "111" > /test/tp1 //ceshi 文本
[root@localhost test]# echo "222" > /test/tp2
[root@localhost test]# service smb restart //开启服务 测试
最新文章
- 【JavaScript】详解JSON
- Redis学习笔记(4) Redis事务、生存时间及排序
- ThreadLocal之我见
- 2016.8.14安装myplayer心得
- unity3D 搞定任意ios插件
- 杀死进程 kill -9
- vmware ubuntu14.04虚拟机不能正常拷贝文件到windows且不能自适应虚拟机屏幕窗口自动变化的解决办法
- 瘸腿蛤蟆笔记29-cocos2d-x-3.2 Box2d物理引擎dynamics模块介绍
- CodeForces 415D Mashmokh and ACM
- 5-jQuery - AJAX get()/post()页面请求即执行
- 谨慎能捕千秋蝉(三)——界面操作劫持与HTML5安全
- Hadoop集群时间同步
- linkin大话数据结构--字符串,数组,list之间的互转
- apache kafka技术分享系列(目录索引)
- ConcurrentHashMap中的putIfAbsent方法的使用以及返回值的含义
- HikariCP和spring-boot-devtools了解
- Spring对Bean装配详解
- virt-install详解
- oracle中斜杠(/)的含义
- gdoi2017