标签:== version 远程主机 public ota column work download ssdb
Samba 文件共享服务
首先需要先通过Yum 软件仓库来安装 Samba 服务程序(Samba 服务程序的名字也恰巧是软件包的名字)
[root@localhost ~]# yum install samba Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Resolving Dependencies --> Running transaction check ---> Package samba.x86_64 0:4.1.1-31.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: samba x86_64 4.1.1-31.el7 rhel7 527 k Transaction Summary ================================================================================ Install 1 Package Total download size: 527 k Installed size: 1.5 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : samba-4.1.1-31.el7.x86_64 1/1 rhel7/productid | 1.6 kB 00:00 Verifying : samba-4.1.1-31.el7.x86_64 1/1 Installed: samba.x86_64 0:4.1.1-31.el7 Complete!
去除Samba服务主配置文件中的注释信息,先把主配置文件改个名字,然后使用 cat 命令读入主配置文件,再在 grep 命令后面添加-v 参数(反向选择),分别去掉所有以井号(#)和分号(;)开头的注释信息行,对于剩余的空白行可以使用^$参数来表示并进行反选过滤,最后把过滤后的可用参数信息通过重定向符覆盖写入到原始文件名称中。
[root@localhost ~]# mv /etc/samba/smb.conf /etc/samba/smb.conf_bak [root@localhost ~]# cat /etc/samba/smb.conf_bak | grep -v "#" | grep -v ";" | grep -v "^$" > /etc/samba/smb.conf [root@localhost ~]# cat /etc/samba/smb.conf [global] workgroup = MYGROUP server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 security = user passdb backend = tdbsam load printers = yes cups options = raw [homes] comment = Home Directories browseable = no writable = yes [printers] comment = All Printers path = /var/spool/samba browseable = no guest ok = no writable = no printable = yes
Samba服务程序中的参数以及作用
[global] | #全局参数。 | |
workgroup = MYGROUP | #工作组名称 | |
server string = Samba Server Version %v | #服务器介绍信息,参数%v为显示SMB版本号 | |
log file = /var/log/samba/log.%m | #定义日志文件的存放位置与名称,参数%m为来访的主机名 | |
max log size = 50 | #定义日志文件的最大容量为50KB | |
security = user | #安全验证的方式,总共有4种 | |
#share:来访主机无需验证口令;比较方便,但安全性很差 | ||
#user:需验证来访主机提供的口令后才可以访问;提升了安全性 | ||
#server:使用独立的远程主机验证来访主机提供的口令(集中管理账户) | ||
#domain:使用域控制器进行身份验证 | ||
passdb backend = tdbsam | #定义用户后台的类型,共有3种 | |
#smbpasswd:使用smbpasswd命令为系统用户设置Samba服务程序的密码 | ||
#tdbsam:创建数据库文件并使用pdbedit命令建立Samba服务程序的用户 | ||
#ldapsam:基于LDAP服务进行账户验证 | ||
load printers = yes | #设置在Samba服务启动时是否共享打印机设备 | |
cups options = raw | #打印机的选项 | |
[homes] | #共享参数 | |
comment = Home Directories | #描述信息 | |
browseable = no | #指定共享信息是否在“网上邻居”中可见 | |
writable = yes | #定义是否可以执行写入操作,与“read only”相反 | |
[printers] | #打印机共享参数 | |
comment = All Printers | ||
path = /var/spool/samba | #共享文件的实际路径(重要)。 | |
browseable = no | ||
guest ok = no | #是否所有人可见,等同于"public"参数。 | |
writable = no | ||
printable = yes |
配置共享资源
用于设置 Samba 服务程序的参数以及作用
参数 | 作用 |
[database] | 共享名称为database |
comment = Do not arbitrarily modify the database file | 警告用户不要随意修改数据库 |
path = /database | 共享目录为/database |
public = no | 关闭“所有人可见” |
writable = yes | 允许写入操作 |
标签:== version 远程主机 public ota column work download ssdb
原文地址:https://www.cnblogs.com/zq8421/p/9952952.html