1.Samba 服务程序现在已经成为在Linux 系统与Windows系统之间共享文件的最佳选择。

  1)安装:  

[root@localhost ~]#yum install samba
Loaded plugins: langpacks, product-id, subscription-manager
………………省略部分输出信息………………
Installing:
samba x86_64 4.1.1-31.el7 rhel 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
Verifying : samba-4.1.1-31.el7.x86_64 1/1
Installed:
samba.x86_64 0:4.1.1-31.el7
Complete!

  Samba 服务程序的主配置文件:/etc/samba/smb.conf

  由于在 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/s
[root@localhost ~]# cat /etc/samba/smb.com
cat: /etc/samba/smb.com: No such file or directory
[root@localhost ~]# cat /etc/samba/smb.conf
[global]
    workgroup = SAMBA
    security = user
    passdb backend = tdbsam
    printing = cups
    printcap name = cups
    load printers = yes
    cups options = raw
[homes]
    comment = Home Directories
    valid users = %S, %D%w%S
    browseable = No
    read only = No
    inherit acls = Yes
[printers]
    comment = All Printers
    path = /var/tmp
    printable = Yes
    create mask = 0600
    browseable = No
[print$]
    comment = Printer Drivers
    path = /var/lib/samba/drivers
    write list = @printadmin root
    force group = @printadmin
    create mask = 0664
    directory mask = 0775

  

posted on 2020-09-25 20:12  星痕1216  阅读(298)  评论(0编辑  收藏  举报