Setting up Windows shared folders in CentOS

Source: Internet
Author: User

Set up samba to implement and Windows shared folders in CentOS. Common needs:
1) Users can access their home directories on a remote Linux server through a shared folder on a Windows machine;
2) Users can access a project group or a departmental shared folder on a Windows machine with full read and write access to the folders in the folder.
To achieve the above requirements, the steps are as follows:

1. Server Install Samba components

[email protected] ~]# Yum install samba.x86_64

2. Configuring the Samba server

Edit the Samba server profile /etc/samba/smb.confand add the following settings in the [global] and [public] sections:
[Global]

Workgroup = Workgroup
Security = User
Display CharSet = UTF8
Unix CharSet = UTF8
DOS charset = cp936

[Public]

Comment = data
Path =/home/cb/data
browseable= Yes
Create Mode= 0664
Directory mode=0775
writable = yes
Write list =@cb

After the configuration is complete, check the configuration
[Email protected] ~]# Testparam

3. Configure Samba Users

Specific requirements:
1) The user CB can access their home directory remotely via Windows shared folder;
2) In addition to the user CB, the/home/cb/data directory is shared to FXD, wh two users

[[email protected] ~]$ chmod G+RWX/HOME/CB//Allow users in the CB group to have RWX permissions on the home directory

[Email protected] ~]$ mkdir data
[[email protected] ~]$ chmod g+s data///samba shared directory typically set GID properties
[[email protected] ~]$ chmod o-rwx data///Remove other users ' access to the shared directory
[Email protected] ~]$ ls-ld data/
Drwxrws---. 2 CB CB 4096 October 4 00:15 data/

[[email protected] ~]# useradd-g CB fxd//Create user Fxd
[Email protected] ~]# passwd fxd
[[email protected] ~]# useradd-g CB wh//Create user WH
[Email protected] ~]# passwd WH
[[email protected] ~]# pdbedit-a-u cb//add Samba user cb, must be Linux system user
[[email protected] ~]# pdbedit-a-u fxd//add Samba user fxd, must be a Linux system user
[[Email protected] ~] # pdbedit-a-u wh//add Samba user wh, must be Linux system user
[Email protected] ~]# pdbedit-l
Cb:500:chenbin
fxd:502:
wh:503:

4. Set SELinux

[[email protected] home]# getsebool-a |grep Samba //Set SELinux Boolean value for Samba
Bacula_use_samba--off
Samba_create_home_dirs--off
Samba_domain_controller--off
samba_enable_home_dirs ---off//To share the home directory, or a subdirectory under the home directory, you need to open the
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
Use_samba_home_dirs--off
Virt_use_samba--off

[Email protected] home]# setsebool-p samba_enable_home_dirs 1

5. Start Samba Service

[Email protected] home]# /etc/init.d/smb Restart
Turn off the SMB service: [OK]
Start the SMB service: [OK]
[Email protected] home]# /etc/init.d/nmb Restart
Close NMB service: [OK]
Start NMB service: [OK]

6. Testing in Windows

Open the "Run" dialog box in Windows, enter: \ \ The IP address of the machine where the shared folder is located, confirm the Login dialog box, enter the samba username and password (for example: fxd/4321), display the shared folder, click on the shared folder to see if it can enter normally. After entering the shared folder, the test can read and write the file correctly. Note: Sometimes shared folders need to double-click the mouse two times to normal entry, the first time will be error and can not enter, double-click will normally enter, do not know what reason.

=-=-=-=-=
Powered by Blogilo

Setting up Windows shared folders in CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.