Configure samba server in centos

Source: Internet
Author: User

Configure samba server in centos

1. Install yum

yum install samba samba-client samba-commo  

2. Set startup

 chkconfig smb on     chkconfig nmb on

3. Add the following configurations to the firewall:

 iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT   iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT   iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT   service iptables save 

4. Configure the configuration file vi/etc/samba/smb. conf of samb and add the following content:

[Global] # global configuration workgroup = WORKGROUP # security = share map to guest = bad user [MyShare] path =/home/samba/share browsable = yes writable = yes guest OK = yes read only = no

Create a file directory and set its permissions

mkdir /home/sambamkdir /home/samba/sharechmod -R 0777 /home/samba/share  

Check the configuration file and restart the service.

testparm  service smb restartservice nmb restart

The above is only public configuration, but user permissions are not set. The following is to set user name permissions to access add user groups.

groupadd users

Add User

useradd gaq

Add User gaq to user group

usermod -a -G users gaq

Set password for samba gaq

Smbpasswd-a gaq # You will be prompted to enter the password

Then we create a directory

mkdir /home/samba/mima

Change directory user group

chgrp users /home/samba/mima

Change permissions

chmod 2755 /home/samba/mima

Modify samba configuration file

vim /etc/samba/smb.conf

Add the following content

[mima]path = /home/samba/mimavalid users = @usersguest ok = nowritable = yesbrowsable = yes

Restart service

service smb restart  service nmb restart  

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.