• CentOS 7 配置samba 和 autofs


    1:服务器配置

    [root@localhost ~]# yum install -y samba

    [root@localhost ~]# pdbedit -a -u alex

    [root@localhost ~]# mkdir /home/smbroot
    [root@localhost ~]# chown -Rf alex:alex /home/smbroot/
    [root@localhost ~]# semanage fcontext -a -t samba_share_t /home/smbroot
    [root@localhost ~]# restorecon -Rv /home/smbroot/

    [root@localhost ~]# getsebool -a | grep samba
    samba_create_home_dirs --> off
    samba_domain_controller --> off
    samba_enable_home_dirs --> off
    samba_export_all_ro --> off
    samba_export_all_rw --> off
    samba_load_libgfapi --> off
    samba_portmapper --> off
    samba_run_unconfined --> off
    samba_share_fusefs --> off
    samba_share_nfs --> off
    sanlock_use_samba --> off
    tmpreaper_use_samba --> off
    use_samba_home_dirs --> off
    virt_use_samba --> off
    [root@localhost ~]# setsebool -P samba_enable_home_dirs on

    [root@localhost ~]# vim /etc/samba/smb.conf

      [global]
      workgroup = SAMBA
      security = user
      server string = Samba Server Version %v
      log file = /var/log/samba/log.%m
      max log size = 50
      passdb backend = tdbsam
      printing = cups
      printcap name = cups
      load printers = yes
      cups options = raw
      [smbroot]
      path = /home/smbroot
      public = no
      writable = yes
      comment = Do not arbitrarily modify the database file

    [root@localhost ~]# firewall-cmd --permanent --add-service=samba
    success
    [root@localhost ~]# systemctl restart firewalld
    [root@localhost ~]# systemctl restart smb
    [root@localhost ~]# systemctl enable smb

    完成!(如果文件在客户端不能修改或删除,可在服务端查看文件是否权限足够)

    2:Windows客户顿直接运行 \192.168.0.188 即可跳出验证登录界面

    3:linux客户端命令行配置

    [root@localhost ~]# yum install cifs-utils

    [root@localhost ~]# vim auth.smb

      username=alex
      password=alex
      domain=SAMBA

    [root@localhost ~]# chmod 600 auth.smb

    [root@localhost ~]# mkdir /smbshare

    [root@localhost ~]# vim /etc/fstab (添加)

      //192.168.10.10/database /database cifs credentials=/root/auth.smb 0 0
    完成!

    4:自动挂载autofs

    [root@localhost ~]# yum install autofs

    [root@localhost ~]# vim /etc/auto.master(主配置文件添加挂载目录的上一级目录 (空格)子配置文件目录)

       /media /etc/iso.misc

    [root@localhost ~]# vim /etc/iso.misc(子配置文件添加    挂载目录(空格)-文件系统类型,权限信息(空格):被挂载目录)

      iso -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

    测试,完成!

    如挂载smb服务器

    [root@localhost ~]# yum install autofs

    [root@localhost ~]# vim /etc/auto.master

       /smb /etc/smb.misc

    [root@localhost ~]# vim /etc/smb.misc

      smbroot -fstype=cifs,username=alex,password=alex ://192.168.0.188/smbroot

    测试,完成!

    注意事项

    1:注意被挂载目录冒号的位置。

    2:挂载超时时间设置在 /etc/sysconfig/autofs

      DEFAULT_TIMEOUT=300

  • 相关阅读:
    覆盖率测试工具gcov的前端工具_LCOV
    LTE切换与TAU问题
    LTE 切换过程中的数据切换
    TCP数据流稳定性--TCP分片,重组及乱序
    【Android
    【Android
    【Android
    【RN
    【RN
    【RN
  • 原文地址:https://www.cnblogs.com/languang9801/p/11105428.html
Copyright © 2020-2023  润新知