linu samba服务
yum install samba samba-client samba-commmon -y
systemctl start smb
pdbedit -L 显示smb用户
smbpasswd -a student 添加smb用户 只能添加系统上已经存在的
[root@localhost ~]# pdbedit -L

ls 与 !ls ls为列出共享目录的文件,!ls为列出,所在所在目录里的文件

mount //172.25.254.103/student /mnt/ -o username=student,password=111 挂载共享文件目录到mnt
cd /mnt
touch westos{1..9}

smbclient //172.25.254.103/student -U student

vim /etc/fstab 设置开机挂载
此时把文件系统挂载在mnt目录下.这样就可以向共享文件系统里写文件了。
改成enforcing
重新启动系统
此时访问不了共享目录关闭火墙 打开smb
smbclient //172.25.254.104/student -U student
Enter student's password:
Connection to 172.25.254.104 failed (Error NT_STATUS_CONNECTION_REFUSED) //当selinux开启时,不能和查看共享文 件系统
[root@localhost ~]# setsebool -P samba_create_home_dirs on
[root@localhost ~]# setsebool -P samba_enable_home_dirs on //打开创建目录查看目录的权限
[root@localhost ~]# vim /etc/samba/smb.conf 创建共享目录,并指定路径
[linux]
comment = dir from westos
path = /westos
[root@localhost ~]# mkdir /westos/file{1..3}
[root@localhost ~]# systemctl start samb 重新启动
[root@localhost ~]# smbclient //172.25.254.104/student -U student 发现查看不了文件
setenforce 0 把selinux变为警告模式
[root@localhost ~]# smbclient //172.25.254.104/student -U student 可以查看
[root@localhost ~]# semanage fcontext -a -t samba_share_t '/westos(/.*)?' // 查看配置文件后发现安全上下文不一致,生成安全上下文
[root@localhost ~]# serenforce 1 //此时开启selinux
[root@localhost ~]# smbclient //172.25.254.104/student -U student //可以查看
[linux]
comment = dir from westos
path = /westos
[mnt]
comment = dir from westos
path = /mnt //设置系统共享目录
rm -rf /westos
mkdir /westos
touch /westos/file1
此时查看就不需要改安全上下文
showmount -e 172.25.254.103
/westos *(sync) /以sync的方式共享/westos上的文件
exportfs -rv 重载,这个文件不能通过重启来生效

自动化挂载:
systemctl start autofs
vim /etc/sysconfig/autofs 配置文件可以更改停止时间
systemctl restart autofs.service

实际挂载目录为 /net/172.25.254.103/westos/
vim /etc/auto.nfs


vim /etc/auto.nfs
/westos *(rw,sync) 使文件具有可写的权限

/westos *(rw,sync,anonuid=1001) 指定文件产生的所有人

/westos *(ew,sync,anonuid=1001,anongid=1000)指定文件所有组所有人
/westos *(rw,sync,no_root_squash) 默认所有组所有人为root
/westos *(ro) 172.25.254(rw,sync,no_rooot_squash)除了这个ip外的所有主机都仅仅有只读权限
linu samba服务的更多相关文章
- samba服务
安装samba服务步骤ps -e 查看进程ps -e | grep 文件名 管道符的使用rpm -qa 安装包的查看rpm -qa | grep samba 抓Samba安装包 注释:包与包之间有依赖 ...
- OpenWrt中开启usb存储和samba服务
在从官网安装的WNDR3800 15.05.1版本OpenWrt中, 不带usb存储支持以及samba, 需要另外安装 1. 启用usb支持 USB Basic Support https://wik ...
- 虚拟机利用Host-only实现在不插网线的情况下,虚拟机与主机实现双向通信,实现ssh连接以及samba服务实现共享
为了不影响其他的虚拟网卡,我们在VMware下在添加一块虚拟网卡: 然后点击Next,选择连接方式: 点击Finish即可. 重新启动虚拟机,如果这是你手动添加的第一块虚拟网卡,那么应该是eth1. ...
- Samba服务配置简明笔记
内部服务器之间拷贝数据,用root账号访问,没有做更复杂的设置. 1.用YUM安装samba服务器端及客户端: [root@tenjs05 init.d]# yum install samba sam ...
- 部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, mounting read-only mount: cannot mount block device //192.168.1.108/mysqldata read-only
部署samba服务之后,在客户端用挂载访问的方式,错误信息:mount: block device //192.168.1.108/mysqldata is write-protected, moun ...
- (转)CentOs上配置samba服务
前 言 在我们使用 Windows 作为客户机的时候,通常有文件.打印共享的需求.作为Windows 网络功能之一,通常可以在 Windows 客户机之间通过 Windows Network 固有的功 ...
- linux基础-第十七单元 Samba服务
Samba的功能 Samba的安装 Samba服务的启动.停止.重启 Samba服务的配置 Samba服务的主配置文件 samba服务器配置实例 Samba客户端设置 windows客户端 Linux ...
- 配置samba服务一例
问题: 在/data/share目录下建立三个子目录public.training.devel用途如下 public目录用于存放公共数据,如公司的规章制度 training目录用于存放公司的技术培训资 ...
- samba服务搭建及管理
关闭防火墙 # /etc/init.d/iptables stop # chkconfig --level iptables off 关闭SELINUX # vim /etc/sysconfig/se ...
随机推荐
- Oracle之DBMS_SQL包用法详解
对于一般的(select)操作,如果使用动态的sql语句则需要进行以下几个步骤:open cursor--->parse---> bind variable ---> defi ...
- g2o20160424 CMakeLists.txt
LIB_PREFIX: 设置生成库的前缀 SET(LIB_PREFIX g2o_) # The library prefix SET(LIB_PREFIX g2o_) 变量的默认配置 # defaul ...
- Luogu 3934 Nephren Ruq Insania
和Ynoi2016 炸脖龙重题了. BZOJ 5394. 首先是扩展欧拉定理: 一开始傻掉了……递归的层数和区间长度无关……也就是说我们每一次直接暴力递归求解子问题一定不会超过$logP$层,因为当模 ...
- 2013年第四届蓝桥杯省赛试题(JavaA组)
1.结果填空 (满分3分)2.结果填空 (满分5分)3.结果填空 (满分6分)4.结果填空 (满分13分)5.代码填空 (满分5分)6.代码填空 (满分10分)7.程序设计(满分4分)8.程序设计(满 ...
- mvvm模式下在WPF项目中动态加载项目的程序集和类
在mvvm模式的wpf项目中有个需求需要去加载解决方案的程序集,并且根据程序集去动态加载当前程序集的类,做成下拉框形式. 效果: //全局定义 private ComboBox abList= nul ...
- 使用metasploit进行栈溢出攻击-4
有了漏洞我们就可以进行攻击了.首先我们需要了解metasploit的exploit模块,具体可以看 http://www.offensive-security.com/metasploit-unlea ...
- java7大设计原则
1.单一职责原则(srp) 每一个对象或者类只有一个职责.高内聚.低耦合. 2.开闭原则(ocp) 对扩展开放,对修改关闭.使用性,灵活性,扩展性,稳定性延续性,重复.维护. 3.里氏替换原则(lsp ...
- 937. Reorder Log Files
You have an array of logs. Each log is a space delimited string of words. For each log, the first w ...
- Python中的map_reduce
原教程地址: map/reduce-廖雪峰 将数值型字符串转换成数值,解释map, reduce的使用: #!/usr/bin/env python #-*- coding:utf-8 -*- ...
- [SinGuLaRiTy] 2017-07-21 综合性测试
[SinGuLaRiTy-1028] Copyright (c) SinGuLaRiTy 2017. All Rights Reserved. 对于所有题目:Time Limit: 1s | Memo ...