samba shared files in linux -cyl

Take (Beijing University Network 16-level Linux upper-level experiment as an example) to establish a samba server to share the directory of the centOS system

  • Step 1:
    Install the samba service through the yum library. Because installing the samba service requires a lot of dependent files to be installed, the relevant dependent files will be automatically installed when the yum source is installed.

    yum list samba* View installable samba packages in the yum repository.
    Then yum -y install samba.x86_64 to install

    If you install through rpm package and tar.gz package, many dependent files are not available, and it is very cumbersome to install many dependent sources yourself. I tried it, and then gave up. It is best to install it through yum, which is convenient, fast and efficient.

    rpm -qa|grep samba View the installation information of the samba service

  • Step 2: Create a shared folder and create a test file
      cd /home
      mkdir sharedir
      chmod 777 /home/sharedir Change the permissions of the directory
      cd sharedir
      vi test.txt
     Write some content in the file: wq save and exit.
     chmod 777 /home/sharedir/test.txt 
     

  • The third step is to change the smb.conf file:
    after entering vi/etc/samba/smb.conf, add the following content at the end:
     write picture description here
     Description:
    comment: Prompt, which is displayed as a comment on the Windows Network Neighborhood.
    path: shared directory on linux
    valid users: users who are allowed to access the shared directory of linux, this user must be the samba user of linux
    public: allow guest to access
    writable: allow users to write
    printable: if set to yes, it is identified as a printer
    create mask: Permissions for files created on shared directories

  • Step 4: Set the account's samba service password
    [root@localhost /]# smbpasswd -a chaiyinlei (note: this is your linux username, create one without a username)
    New SMB password:
    Retype new SMB password:
    Added user chaiyinlei.

  • The fifth step is to start the samba service Enter the following command
    in turn
    service smb start (star can be changed to restart) or this command (systemctl start smb.service)

    service iptables stop or this command (iptables -F)

    setenforce 0

  • Step 6 Enter "\\192.168.0.109"
    in "Start > Run" to log in to the target server to find
    write picture description here
     

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325530516&siteId=291194637