Linux目录共享设置

作者:xcbeyond
疯狂源自梦想,技术成就辉煌!微信公众号:《程序猿技术大咖》号主,专注后端开发多年,拥有丰富的研发经验,乐于技术输出、分享,现阶段从事微服务架构项目的研发工作,涉及架构设计、技术选型、业务研发等工作。对于Java、微服务、数据库、Docker有深入了解,并有大量的调优经验。 









  1、简介

    Linux目录共享采用samba方式。

     Samba,是在Unix上实现SMB(Server Message Block)的一个工具套件。而SMB通常是windows用来实现共享的,包括文件和打印机等。而Unix上装上SMB,则使得Unix能够和windows连接在一起,实现两者的资源互通。
2、安装

  本文采用yum在线方式安装,yum install samba,如下所示:

    [root@share share]# yum install samba
    Loaded plugins: fastestmirror, langpacks
    Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
    base                                                             |  892 B  00:00:00     
    Not using downloaded repomd.xml because it is older than what we have:
      Current   : Fri May  4 04:17:37 2018
      Downloaded: Thu Jan  1 08:00:00 1970
    dockerrepo                                                       | 2.9 kB  00:00:00     
    extras                                                           |  892 B  00:00:00     
    Not using downloaded repomd.xml because it is older than what we have:
      Current   : Sat Aug 25 04:19:14 2018
      Downloaded: Thu Jan  1 08:00:00 1970
    nodesource                                                       | 2.5 kB  00:00:00     
    updates                                                          |  892 B  00:00:00     
    Not using downloaded repomd.xml because it is older than what we have:
      Current   : Tue Aug 28 20:52:42 2018
      Downloaded: Thu Jan  1 08:00:00 1970
    yarn                                                             | 2.9 kB  00:00:00     
    yarn/primary_db                                                                                                                                                                   |  19 kB  00:00:10     
    Determining fastest mirrors
     * base: mirrors.njupt.edu.cn
     * extras: mirrors.njupt.edu.cn
     * updates: mirrors.njupt.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package samba.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package samba.x86_64 0:4.7.1-9.el7_5 will be an update
    --> Processing Dependency: samba-libs = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: samba-common-tools = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: samba-common-libs = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: samba-common = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: samba-common = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: samba-client-libs = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libwbclient = 4.7.1-9.el7_5 for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libxattr-tdb-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libutil-tdb-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libutil-reg-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsys-rw-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsocket-blocking-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsmbd-shim-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsmbd-base-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsmb-transport-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libserver-id-db-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsecrets3-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba3-util-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba-sockets-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba-security-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba-errors.so.1(SAMBA_ERRORS_1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba-debug-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba-cluster-support-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libreplace-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libpopt-samba3-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libndr-samba-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libmsghdr-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libmessages-dgm-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: liblibsmb-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libgse-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libgenrand-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libdbwrap-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libdbus-1.so.3(LIBDBUS_1_3)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libcliauth-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libcli-smb-common-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libcli-nbt-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libcli-cldap-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libauth-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libCHARSET3-samba4.so(SAMBA_4.7.1)(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsys-rw-samba4.so()(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libserver-id-db-samba4.so()(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libsamba-errors.so.1()(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libmsghdr-samba4.so()(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libmessages-dgm-samba4.so()(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libgenrand-samba4.so()(64bit) for package: samba-4.7.1-9.el7_5.x86_64
    --> Running transaction check
    ---> Package dbus-libs.x86_64 1:1.6.12-13.el7 will be updated
    --> Processing Dependency: dbus-libs(x86-64) = 1:1.6.12-13.el7 for package: 1:dbus-1.6.12-13.el7.x86_64
    ---> Package dbus-libs.x86_64 1:1.10.24-7.el7 will be an update
    ---> Package libwbclient.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package libwbclient.x86_64 0:4.7.1-9.el7_5 will be an update
    ---> Package samba-client-libs.x86_64 0:4.2.3-12.el7_2 will be updated
    --> Processing Dependency: samba-client-libs = 4.2.3-12.el7_2 for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: samba-client-libs = 4.2.3-12.el7_2 for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libaddns-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libCHARSET3-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcliauth-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcli-cldap-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcli-ldap-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcli-smb-common-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcli-smb-common-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcli-spoolss-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libcmdline-credentials-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libdbwrap-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libdcerpc-samba-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libdcerpc-samba-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liberrors-samba4.so()(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liberrors-samba4.so()(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liberrors-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liberrors-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libevents-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libgensec.so.0()(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libgensec.so.0(GENSEC_0.0.1)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libgse-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libgse-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libldbsamba-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liblibcli-lsa3-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liblibcli-lsa3-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liblibcli-netlogon3-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liblibsmb-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: liblibsmb-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libmsrpc3-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libmsrpc3-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libndr-samba-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libntdb.so.1()(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libntdb.so.1(NTDB_0.9)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libregistry.so.0()(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libregistry.so.0(REGISTRY_0.0.1)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libreplace-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libreplace-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamba3-util-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamba-debug-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamba-debug-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamba-security-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamba-security-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamba-sockets-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsamdb-common-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsecrets3-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsecrets3-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libserver-role-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsmbclient-raw.so.0()(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsmbclient-raw.so.0(SMBCLIENT_RAW_0.0.1)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsmbregistry-samba4.so()(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsmbregistry-samba4.so()(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsmbregistry-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libsmbregistry-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libtrusts-util-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libutil-cmdline-samba4.so(SAMBA_4.2.3)(64bit) for package: libsmbclient-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libutil-cmdline-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libutil-reg-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    --> Processing Dependency: libutil-tdb-samba4.so(SAMBA_4.2.3)(64bit) for package: samba-client-4.2.3-12.el7_2.x86_64
    ---> Package samba-client-libs.x86_64 0:4.7.1-9.el7_5 will be an update
    --> Processing Dependency: krb5-libs >= 1.15.1 for package: samba-client-libs-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libtevent.so.0(TEVENT_0.9.31)(64bit) for package: samba-client-libs-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libtevent.so.0(TEVENT_0.9.30)(64bit) for package: samba-client-libs-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libtdb.so.1(TDB_1.3.11)(64bit) for package: samba-client-libs-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libldb.so.1(LDB_1.1.30)(64bit) for package: samba-client-libs-4.7.1-9.el7_5.x86_64
    ---> Package samba-common.noarch 0:4.2.3-12.el7_2 will be updated
    ---> Package samba-common.noarch 0:4.7.1-9.el7_5 will be an update
    ---> Package samba-common-libs.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package samba-common-libs.x86_64 0:4.7.1-9.el7_5 will be an update
    ---> Package samba-common-tools.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package samba-common-tools.x86_64 0:4.7.1-9.el7_5 will be an update
    ---> Package samba-libs.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package samba-libs.x86_64 0:4.7.1-9.el7_5 will be an update
    --> Processing Dependency: libpytalloc-util.so.2(PYTALLOC_UTIL_2.1.9)(64bit) for package: samba-libs-4.7.1-9.el7_5.x86_64
    --> Processing Dependency: libpytalloc-util.so.2(PYTALLOC_UTIL_2.1.6)(64bit) for package: samba-libs-4.7.1-9.el7_5.x86_64
    --> Running transaction check
    ---> Package dbus.x86_64 1:1.6.12-13.el7 will be updated
    --> Processing Dependency: dbus = 1:1.6.12-13.el7 for package: 1:dbus-x11-1.6.12-13.el7.x86_64
    ---> Package dbus.x86_64 1:1.10.24-7.el7 will be an update
    ---> Package krb5-libs.x86_64 0:1.13.2-10.el7 will be updated
    --> Processing Dependency: krb5-libs(x86-64) = 1.13.2-10.el7 for package: krb5-server-1.13.2-10.el7.x86_64
    --> Processing Dependency: krb5-libs(x86-64) = 1.13.2-10.el7 for package: krb5-pkinit-1.13.2-10.el7.x86_64
    --> Processing Dependency: krb5-libs(x86-64) = 1.13.2-10.el7 for package: krb5-workstation-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5clnt_mit.so.8()(64bit) for package: krb5-server-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5clnt_mit.so.8()(64bit) for package: krb5-workstation-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5clnt_mit.so.8(kadm5clnt_mit_8_MIT)(64bit) for package: krb5-server-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5clnt_mit.so.8(kadm5clnt_mit_8_MIT)(64bit) for package: krb5-workstation-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5srv_mit.so.9()(64bit) for package: krb5-server-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5srv_mit.so.9()(64bit) for package: krb5-workstation-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5srv_mit.so.9(kadm5srv_mit_9_MIT)(64bit) for package: krb5-server-1.13.2-10.el7.x86_64
    --> Processing Dependency: libkadm5srv_mit.so.9(kadm5srv_mit_9_MIT)(64bit) for package: krb5-workstation-1.13.2-10.el7.x86_64
    ---> Package krb5-libs.x86_64 0:1.15.1-19.el7 will be an update
    ---> Package libldb.x86_64 0:1.1.20-1.el7_2.2 will be updated
    ---> Package libldb.x86_64 0:1.2.2-1.el7 will be an update
    ---> Package libsmbclient.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package libsmbclient.x86_64 0:4.7.1-9.el7_5 will be an update
    ---> Package libtdb.x86_64 0:1.3.6-2.el7 will be updated
    ---> Package libtdb.x86_64 0:1.3.15-1.el7 will be an update
    ---> Package libtevent.x86_64 0:0.9.25-1.el7 will be updated
    ---> Package libtevent.x86_64 0:0.9.33-2.el7 will be an update
    ---> Package pytalloc.x86_64 0:2.1.2-1.el7 will be updated
    ---> Package pytalloc.x86_64 0:2.1.10-1.el7 will be an update
    --> Processing Dependency: libtalloc = 2.1.10-1.el7 for package: pytalloc-2.1.10-1.el7.x86_64
    ---> Package samba-client.x86_64 0:4.2.3-12.el7_2 will be updated
    ---> Package samba-client.x86_64 0:4.7.1-9.el7_5 will be an update
    --> Running transaction check
    ---> Package dbus-x11.x86_64 1:1.6.12-13.el7 will be updated
    ---> Package dbus-x11.x86_64 1:1.10.24-7.el7 will be an update
    ---> Package krb5-pkinit.x86_64 0:1.13.2-10.el7 will be updated
    ---> Package krb5-pkinit.x86_64 0:1.15.1-19.el7 will be an update
    ---> Package krb5-server.x86_64 0:1.13.2-10.el7 will be updated
    ---> Package krb5-server.x86_64 0:1.15.1-19.el7 will be an update
    --> Processing Dependency: libkadm5(x86-64) = 1.15.1-19.el7 for package: krb5-server-1.15.1-19.el7.x86_64
    --> Processing Dependency: libkadm5srv_mit.so.11(kadm5srv_mit_11_MIT)(64bit) for package: krb5-server-1.15.1-19.el7.x86_64
    --> Processing Dependency: libkadm5clnt_mit.so.11(kadm5clnt_mit_11_MIT)(64bit) for package: krb5-server-1.15.1-19.el7.x86_64
    --> Processing Dependency: libkadm5srv_mit.so.11()(64bit) for package: krb5-server-1.15.1-19.el7.x86_64
    --> Processing Dependency: libkadm5clnt_mit.so.11()(64bit) for package: krb5-server-1.15.1-19.el7.x86_64
    ---> Package krb5-workstation.x86_64 0:1.13.2-10.el7 will be updated
    ---> Package krb5-workstation.x86_64 0:1.15.1-19.el7 will be an update
    ---> Package libtalloc.x86_64 0:2.1.2-1.el7 will be updated
    ---> Package libtalloc.x86_64 0:2.1.10-1.el7 will be an update
    --> Running transaction check
    ---> Package libkadm5.x86_64 0:1.15.1-19.el7 will be installed
    --> Finished Dependency Resolution
     
    Dependencies Resolved
     
    =========================================================================================================================================================================================================
     Package                                                Arch                                       Version                                             Repository                                   Size
    =========================================================================================================================================================================================================
    Updating:
     samba                                                  x86_64                                     4.7.1-9.el7_5                                       updates                                     662 k
    Installing for dependencies:
     libkadm5                                               x86_64                                     1.15.1-19.el7                                       updates                                     175 k
    Updating for dependencies:
     dbus                                                   x86_64                                     1:1.10.24-7.el7                                     base                                        245 k
     dbus-libs                                              x86_64                                     1:1.10.24-7.el7                                     base                                        169 k
     dbus-x11                                               x86_64                                     1:1.10.24-7.el7                                     base                                         47 k
     krb5-libs                                              x86_64                                     1.15.1-19.el7                                       updates                                     747 k
     krb5-pkinit                                            x86_64                                     1.15.1-19.el7                                       updates                                     163 k
     krb5-server                                            x86_64                                     1.15.1-19.el7                                       updates                                     1.0 M
     krb5-workstation                                       x86_64                                     1.15.1-19.el7                                       updates                                     814 k
     libldb                                                 x86_64                                     1.2.2-1.el7                                         base                                        131 k
     libsmbclient                                           x86_64                                     4.7.1-9.el7_5                                       updates                                     132 k
     libtalloc                                              x86_64                                     2.1.10-1.el7                                        base                                         33 k
     libtdb                                                 x86_64                                     1.3.15-1.el7                                        base                                         48 k
     libtevent                                              x86_64                                     0.9.33-2.el7                                        base                                         37 k
     libwbclient                                            x86_64                                     4.7.1-9.el7_5                                       updates                                     107 k
     pytalloc                                               x86_64                                     2.1.10-1.el7                                        base                                         17 k
     samba-client                                           x86_64                                     4.7.1-9.el7_5                                       updates                                     609 k
     samba-client-libs                                      x86_64                                     4.7.1-9.el7_5                                       updates                                     4.8 M
     samba-common                                           noarch                                     4.7.1-9.el7_5                                       updates                                     205 k
     samba-common-libs                                      x86_64                                     4.7.1-9.el7_5                                       updates                                     162 k
     samba-common-tools                                     x86_64                                     4.7.1-9.el7_5                                       updates                                     464 k
     samba-libs                                             x86_64                                     4.7.1-9.el7_5                                       updates                                     275 k
     
    Transaction Summary
    =========================================================================================================================================================================================================
    Install             (  1 Dependent package)
    Upgrade  1 Package  (+20 Dependent packages)
     
    Total size: 11 M
    Is this ok [y/d/N]: y
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Updating   : libtalloc-2.1.10-1.el7.x86_64                                                                                                                                                        1/43
      Updating   : libtevent-0.9.33-2.el7.x86_64                                                                                                                                                        2/43
      Updating   : krb5-libs-1.15.1-19.el7.x86_64                                                                                                                                                       3/43
      Updating   : libtdb-1.3.15-1.el7.x86_64                                                                                                                                                           4/43
      Updating   : samba-common-4.7.1-9.el7_5.noarch                                                                                                                                                    5/43
      Updating   : libldb-1.2.2-1.el7.x86_64                                                                                                                                                            6/43
      Updating   : samba-common-libs-4.7.1-9.el7_5.x86_64                                                                                                                                               7/43
      Updating   : libwbclient-4.7.1-9.el7_5.x86_64                                                                                                                                                     8/43
      Updating   : samba-client-libs-4.7.1-9.el7_5.x86_64                                                                                                                                               9/43
      Updating   : 1:dbus-libs-1.10.24-7.el7.x86_64                                                                                                                                                    10/43
      Installing : libkadm5-1.15.1-19.el7.x86_64                                                                                                                                                       11/43
      Updating   : 1:dbus-1.10.24-7.el7.x86_64                                                                                                                                                         12/43
      Updating   : libsmbclient-4.7.1-9.el7_5.x86_64                                                                                                                                                   13/43
      Updating   : pytalloc-2.1.10-1.el7.x86_64                                                                                                                                                        14/43
      Updating   : samba-libs-4.7.1-9.el7_5.x86_64                                                                                                                                                     15/43
      Updating   : samba-common-tools-4.7.1-9.el7_5.x86_64                                                                                                                                             16/43
      Updating   : samba-4.7.1-9.el7_5.x86_64                                                                                                                                                          17/43
      Updating   : samba-client-4.7.1-9.el7_5.x86_64                                                                                                                                                   18/43
      Updating   : 1:dbus-x11-1.10.24-7.el7.x86_64                                                                                                                                                     19/43
      Updating   : krb5-workstation-1.15.1-19.el7.x86_64                                                                                                                                               20/43
      Updating   : krb5-server-1.15.1-19.el7.x86_64                                                                                                                                                    21/43
      Updating   : krb5-pkinit-1.15.1-19.el7.x86_64                                                                                                                                                    22/43
      Cleanup    : samba-4.2.3-12.el7_2.x86_64                                                                                                                                                         23/43
      Cleanup    : samba-client-4.2.3-12.el7_2.x86_64                                                                                                                                                  24/43
      Cleanup    : libsmbclient-4.2.3-12.el7_2.x86_64                                                                                                                                                  25/43
      Cleanup    : samba-libs-4.2.3-12.el7_2.x86_64                                                                                                                                                    26/43
      Cleanup    : samba-common-tools-4.2.3-12.el7_2.x86_64                                                                                                                                            27/43
      Cleanup    : samba-common-libs-4.2.3-12.el7_2.x86_64                                                                                                                                             28/43
      Cleanup    : samba-common-4.2.3-12.el7_2.noarch                                                                                                                                                  29/43
      Cleanup    : libwbclient-4.2.3-12.el7_2.x86_64                                                                                                                                                   30/43
      Cleanup    : samba-client-libs-4.2.3-12.el7_2.x86_64                                                                                                                                             31/43
      Cleanup    : libldb-1.1.20-1.el7_2.2.x86_64                                                                                                                                                      32/43
      Cleanup    : libtevent-0.9.25-1.el7.x86_64                                                                                                                                                       33/43
      Cleanup    : pytalloc-2.1.2-1.el7.x86_64                                                                                                                                                         34/43
      Cleanup    : krb5-pkinit-1.13.2-10.el7.x86_64                                                                                                                                                    35/43
      Cleanup    : krb5-server-1.13.2-10.el7.x86_64                                                                                                                                                    36/43
      Cleanup    : krb5-workstation-1.13.2-10.el7.x86_64                                                                                                                                               37/43
      Cleanup    : 1:dbus-x11-1.6.12-13.el7.x86_64                                                                                                                                                     38/43
      Cleanup    : 1:dbus-1.6.12-13.el7.x86_64                                                                                                                                                         39/43
      Cleanup    : 1:dbus-libs-1.6.12-13.el7.x86_64                                                                                                                                                    40/43
      Cleanup    : krb5-libs-1.13.2-10.el7.x86_64                                                                                                                                                      41/43
      Cleanup    : libtalloc-2.1.2-1.el7.x86_64                                                                                                                                                        42/43
      Cleanup    : libtdb-1.3.6-2.el7.x86_64                                                                                                                                                           43/43
      Verifying  : 1:dbus-x11-1.10.24-7.el7.x86_64                                                                                                                                                      1/43
      Verifying  : libtevent-0.9.33-2.el7.x86_64                                                                                                                                                        2/43
      Verifying  : samba-common-libs-4.7.1-9.el7_5.x86_64                                                                                                                                               3/43
      Verifying  : 1:dbus-libs-1.10.24-7.el7.x86_64                                                                                                                                                     4/43
      Verifying  : samba-common-tools-4.7.1-9.el7_5.x86_64                                                                                                                                              5/43
      Verifying  : samba-libs-4.7.1-9.el7_5.x86_64                                                                                                                                                      6/43
      Verifying  : samba-common-4.7.1-9.el7_5.noarch                                                                                                                                                    7/43
      Verifying  : 1:dbus-1.10.24-7.el7.x86_64                                                                                                                                                          8/43
      Verifying  : samba-client-4.7.1-9.el7_5.x86_64                                                                                                                                                    9/43
      Verifying  : krb5-workstation-1.15.1-19.el7.x86_64                                                                                                                                               10/43
      Verifying  : libldb-1.2.2-1.el7.x86_64                                                                                                                                                           11/43
      Verifying  : libtdb-1.3.15-1.el7.x86_64                                                                                                                                                          12/43
      Verifying  : samba-client-libs-4.7.1-9.el7_5.x86_64                                                                                                                                              13/43
      Verifying  : libtalloc-2.1.10-1.el7.x86_64                                                                                                                                                       14/43
      Verifying  : libwbclient-4.7.1-9.el7_5.x86_64                                                                                                                                                    15/43
      Verifying  : krb5-libs-1.15.1-19.el7.x86_64                                                                                                                                                      16/43
      Verifying  : libsmbclient-4.7.1-9.el7_5.x86_64                                                                                                                                                   17/43
      Verifying  : krb5-server-1.15.1-19.el7.x86_64                                                                                                                                                    18/43
      Verifying  : samba-4.7.1-9.el7_5.x86_64                                                                                                                                                          19/43
      Verifying  : libkadm5-1.15.1-19.el7.x86_64                                                                                                                                                       20/43
      Verifying  : pytalloc-2.1.10-1.el7.x86_64                                                                                                                                                        21/43
      Verifying  : krb5-pkinit-1.15.1-19.el7.x86_64                                                                                                                                                    22/43
      Verifying  : 1:dbus-1.6.12-13.el7.x86_64                                                                                                                                                         23/43
      Verifying  : libtalloc-2.1.2-1.el7.x86_64                                                                                                                                                        24/43
      Verifying  : krb5-workstation-1.13.2-10.el7.x86_64                                                                                                                                               25/43
      Verifying  : libtevent-0.9.25-1.el7.x86_64                                                                                                                                                       26/43
      Verifying  : libtdb-1.3.6-2.el7.x86_64                                                                                                                                                           27/43
      Verifying  : 1:dbus-x11-1.6.12-13.el7.x86_64                                                                                                                                                     28/43
      Verifying  : samba-4.2.3-12.el7_2.x86_64                                                                                                                                                         29/43
      Verifying  : krb5-server-1.13.2-10.el7.x86_64                                                                                                                                                    30/43
      Verifying  : samba-common-tools-4.2.3-12.el7_2.x86_64                                                                                                                                            31/43
      Verifying  : 1:dbus-libs-1.6.12-13.el7.x86_64                                                                                                                                                    32/43
      Verifying  : krb5-libs-1.13.2-10.el7.x86_64                                                                                                                                                      33/43
      Verifying  : samba-client-4.2.3-12.el7_2.x86_64                                                                                                                                                  34/43
      Verifying  : libsmbclient-4.2.3-12.el7_2.x86_64                                                                                                                                                  35/43
      Verifying  : samba-common-4.2.3-12.el7_2.noarch                                                                                                                                                  36/43
      Verifying  : pytalloc-2.1.2-1.el7.x86_64                                                                                                                                                         37/43
      Verifying  : libwbclient-4.2.3-12.el7_2.x86_64                                                                                                                                                   38/43
      Verifying  : samba-common-libs-4.2.3-12.el7_2.x86_64                                                                                                                                             39/43
      Verifying  : libldb-1.1.20-1.el7_2.2.x86_64                                                                                                                                                      40/43
      Verifying  : samba-client-libs-4.2.3-12.el7_2.x86_64                                                                                                                                             41/43
      Verifying  : krb5-pkinit-1.13.2-10.el7.x86_64                                                                                                                                                    42/43
      Verifying  : samba-libs-4.2.3-12.el7_2.x86_64                                                                                                                                                    43/43
     
    Dependency Installed:
      libkadm5.x86_64 0:1.15.1-19.el7                                                                                                                                                                        
     
    Updated:
      samba.x86_64 0:4.7.1-9.el7_5                                                                                                                                                                           
     
    Dependency Updated:
      dbus.x86_64 1:1.10.24-7.el7                   dbus-libs.x86_64 1:1.10.24-7.el7                   dbus-x11.x86_64 1:1.10.24-7.el7                     krb5-libs.x86_64 0:1.15.1-19.el7                  
      krb5-pkinit.x86_64 0:1.15.1-19.el7            krb5-server.x86_64 0:1.15.1-19.el7                 krb5-workstation.x86_64 0:1.15.1-19.el7             libldb.x86_64 0:1.2.2-1.el7                       
      libsmbclient.x86_64 0:4.7.1-9.el7_5           libtalloc.x86_64 0:2.1.10-1.el7                    libtdb.x86_64 0:1.3.15-1.el7                        libtevent.x86_64 0:0.9.33-2.el7                   
      libwbclient.x86_64 0:4.7.1-9.el7_5            pytalloc.x86_64 0:2.1.10-1.el7                     samba-client.x86_64 0:4.7.1-9.el7_5                 samba-client-libs.x86_64 0:4.7.1-9.el7_5          
      samba-common.noarch 0:4.7.1-9.el7_5           samba-common-libs.x86_64 0:4.7.1-9.el7_5           samba-common-tools.x86_64 0:4.7.1-9.el7_5           samba-libs.x86_64 0:4.7.1-9.el7_5                 
     
    Complete!

3、配置
3.1 创建共享目录

   把目录/home/share/share作为共享目录,则进行共享目录的创建。

   mkdir -m 777 /home/share/share

[root@share share]# mkdir -m 777 /home/share/share

3.2 配置修改

 修改/etc/samba/smb.conf

samba的配置文件放在/etc/samba/smb.conf文件夹下,文件可以分为两大部分,第一部分是全局配置,第二部分是局部配置。

在/etc/samba/smb.conf中添加如下内容:

    [global]
            workgroup = SAMBA
            security = user
     
            passdb backend = tdbsam
     
            printing = cups
            printcap name = cups
            load printers = yes
            cups options = raw
    [share]
            comment = 共享路径
            path = /home/share/share
            public = yes
            writeable = yes
            browseable = yes

详细参数说明如下:

[global]  #全局配置,配置文件以[segname]分段,除了global影响全部段之外,各段之间互不影响
        workgroup = MYGROUP    #samba的工作组
        server string = Samba Server Version %v    #samba的说明信息
        netbios name =Aric    #简单的说就是计算机名称
        log file = /var/log/samba/%m.log    #日志文件存放位置
        max log size = 10    #日志文件大小,以M为单位
        security = share    #安全选项,可以是share,user,server,domain安全级别递增
        encrypt passwords = yes    #密码是否加密
        smb passwd file = /etc/samba/smbpasswd    #密码文件存放位置
        username map = /etc/samba/smbusers    #用户文件存放位置
[share]        #局部配置,[]里面是段名,也就是我们的共享名
        comment = This is my shared folder.    #该共享的说明
        path = /home/share    #共享路径
        writeable = yes        #共享文件夹是否可写
        browseable = yes    #是否可浏览
        guest ok = yes        #跟public一样,是否允许guest用户
        create mode =0664    #创建文件权限定制
        directory mode=0775    #创建文件夹权限
        valid users=允许访问该共享的用户
        invalid usrs=禁止访问的用户,root,@group,@表示组    
        admin users=该共享的管理者
        write list=有写权限的用户
       display charset=UTF-8
       unix charset=UTF-8
       dos charset=UTF-8  #这三个是避免乱码的,dispaly是显示目录时的编码,另外两个跟名字对应。若dos下为zh_CN.GB2312.GBK。则3个全部设为cp936
4、重启smb服务

 service smb restart
5、创建samba客户

如果/etc/samba/smb.conf中 global配置的security 设置为share时,需要创建密码。

smbpasswd -a share,回车后会提示输入密码。这个就是将来远程主机登录时需要的密码,这里的docker帐号必须是系统已经有的帐号,没有的话会报错,然后新输的密码就是远程登录密码,这样做的好处就是自己的密码和远程登录的密码分开。

    [root@share share]# smbpasswd -a share
    New SMB password:
    Retype new SMB password:
    Added user share.

6、验证

     windows下连接,启动运行,输入\\192.168.1.200,输入smb帐号密码就可以了