Installation and configuration of the Samba server [perfect]

Source: Internet
Author: User

Cenots 6.3 x86_64samba Server IP Address: 192.168.1.53 note: In this experiment, both iptables firewall and selinux are disabled. 1. Install samba. log on to the system and check whether the samba software package is installed. The check command is as follows: [root @ data ~] # Rpm-qa | grep samba
Samba-winbind-clients-3.5.10-125.el6.x86_64
Samba-3.5.10-125.el6.x86_64
Samba-common-3.5.10-125.el6.x86_64
If there is output, it indicates that it has been installed. If there is no output, you can use yum-y install samba to install it. After samba is installed, the configuration file directory/etc/samba is generated. 2. Add the shared directory to the core configuration file smb. conf. The content is as follows: [root @ data ~] # Cd/etc/samba/
[Root @ data samba] # cp smb. conf smb. conf. bak20121130 // back up the configuration file
[Root @ data samba] # vim smb. conf
[Global] // indicates that the following content is global configuration and must have
Workgroup = WORKGROUP // defines a working group,
Netbios name = chlinux.net // defines the name of the computer displayed in windows
Server string = my linux samba server // defines the samba server description
Log file =/var/log/samba/% m. log // defines the samba log file. % m indicates the client host name. The samba server creates different log files for each logon main sentence in the specified directory.
Security = share // defines the data sharing method. Commonly Used user and share are used. user indicates that data can be shared only after password verification is required. share indicates that data can be directly shared,
[Sharing] // defines the shared directory displayed in windows
Path = // data // path of the shared data
Writeable = yes // specify whether the setting is writable, yes is writable, no is writable
Browseable = yes // defines whether shared folders can be viewed in windows. If you want to hide shared folders, set it to no
Guest OK = yes // defines whether anonymous users can write
3. Create a shared directory:[Root @ data samba] # mkdir/data // create a shared directory
[Root @ data samba] # chown nobody: nobody/data // to design anonymous users to upload and download data, authorize/data wood to be nobody
[Root @ data samba] # cp/etc/passwd/data // copy the test file to the shared directory
4. composition and use of the samba service: two services are running on samba, one is SMB and the other is NMB. SMB is the core of samba, only the SMB service can be started to share files, while the NMB Service is responsible for parsing, similar to the DNS implementation function, NMB can correspond the linux system's shared workgroup name to its IP address. If NMB is not started, you can only access shared files through IP addresses. You can use/etc/init. d/smb start/stop/restart to start, shut down, and restart: [root @ data samba] #/etc/init. d/smb start
Start the SMB service: [OK]
[Root @ data samba] #/etc/init. d/nmb start
Start NMB service: [OK]
[Root @ data samba] #
5. Access the shared file on the samba server and run \ 192.168.1.53. The following interface indicates that the file is successfully displayed. 650) this. width = 650; "src = ".. /attachment/201212/114554972 .png" border = "0" alt = ""/> 6. Authorize logging on to the samba server: 1. Add system-level users share1 and share2 first, specify the working directory/share1 and share2 as follows: [root @ data samba] # useradd-d/share1-s/sbin/nologin share1 // create a user, specify the home directory and shell
[Root @ data samba] # useradd-d/share2-s/sbin/nologin share2
[Root @ data samba] # cp/root/install. log */share1/
[Root @ data samba] # cd/share1
[Root @ data share1] # ll
Total usage 56
-Rw-r --. 1 root 41933 December 1 07:35 install. log
-Rw-r --. 1 root 8206 December 1 07:35 install. log. syslog
3. Configure the smb. conf file [global]
Workgroup = WORKGROUP
Netbios name = chlinux.net
Server string = my linux samba server
Log file =/var/log/samba/% m. log
Max log size = 50
Security = user
Encrypt passwords = yes
Smb passwd file =/etc/samba/smbpasswd
Socket options = 192.168.1.254/24 192.168.2.254/24
OS level = 33
[Share1]
Path =/data
Comment = This is share1
Valid users = share1
Writeable = yes
Browseable = yes
[Share2]
Path =/data
Comment = This is share2
Valid users = share2
Writeable = yes
Browseable = yes
Create mask = 664
Directory mask = 755
Writeable = yes
Browseable = yes
Max log size // defines the size of the log file. Setting it to 0 indicates no limit. The default unit is KB. The configuration above is basically the same as that in the preceding example, it only adds some permission control items. The meaning of the new options is as follows: encrypt passwords // sets whether the user password is encrypted. yes indicates encryption, no indicates that smb passwd file is not encrypted. // specify the password file OS level of the samba user. // defines the OS level of the samba server. The OS level value ranges from 0 to 255, the windows NT value is 33, and the windows 95/98 value is 1, the OS level value of samba server must be at least 33 comment // description of the shared directory valid users // definition of the user who accesses the client create mask // definition of the default permission for the client user to create files is 644, indicates readable and writable directory mask // defines that the default permission for creating directories by client users is 755 , Indicates readable and writable execution. 4. Test the samba server and restart the smb service. Then, perform authorized logon on the windows client, enter \ 192.168.1.53 in IE browser, and press enter to enter the interface shown below. 650) this. width = 650; "src = ".. /attachment/201212/114819914 .png" border = "0" alt = ""/> here, enter the samba user to log on to. Here, we log on to share1. after entering the password to log on, we can see the following figure: 650) this. width = 650; "src = ".. /attachment/201212/114859584 .png" border = "0" alt = ""/> so far samba has been installed. For more information, visit the http://www.chlinux.net.

This article from the "ordinary days" blog, please be sure to keep this source http://wolfchen.blog.51cto.com/2211749/1087819

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.