Linux Samba installation configuration Summary

Source: Internet
Author: User

Learning about Embedded Linux development, Samba, which was originally set up on the Internet, found that the file directory created in the shared directory is an anonymous user and always needs to modify file permissions, therefore, it takes some time to study how to install and use Samba to set the shared directory, which is summarized as follows:

1. Samba installation. I am using ubuntu10.10 Linux operating system. Other operating systems may be different:

-- 1. Install the samba service: sudo apt-Get install Samba // install the Service to use the samba shared directory.
-- 2. Install smbfs sudo apt-Get install smbfs //??
-- 3. Install the graphical Configuration tool sudo apt-Get install system-config-Samba // after installation, you can view the samba tool in the system/System Management menu.

2. Two configuration files:

-- 1. Samba configuration file location:/etc/samba/smb. conf // SAMBA service configuration file

-- 2. Samba user pairing file:/etc/samba/smbusers

3. Samba Startup Script: the samba STARTUP script is in/etc/rc. d/init. d/smbd.

// Note that you must execute the following command to re-load the configuration every time you modify the samba configuration using a graphical tool.

-- Overload Samba configuration:/etc/rc. d/init. d/smbd reload
-- Restart the samba service:/etc/rc. d/init. d/smbd restart

4. smb. conf syntax
-- 1. The parameters defined in [Global] are used to control the overall features of Samba. In addition to the global part, each part defines a special service.
Workgroup = workgroup // set a Working Group
Server String = % H server (Samba, UBUNTU) // set the Host Name
Security = user // The security setting user indicates the user level, and the other is share: Share Level
The [Global] section also defines the log file directory and the location of the locked file. Log files are useful when troubleshooting and improving the system. Locking a file can prevent multiple users from modifying the same file at the same time.
-- 2. The setting in the [homes] section controls the sharing permissions of each home directory. The string specified by the comment parameter appears next to the specified resource when you browse the local resource.
The browseable parameter controls whether a service can appear in the network resource browsing table.
Read Only
-- Add a shared directory
[Stonecao] // a new shared service
Comment = stonecao
Path =/home/stonecao // shared service directory
Writeable = Yes // write permission
; Browseable = Yes
Valid users = stonecao // you need to verify that one of the samba users is available.

I don't know much about many specific configuration items. After all, I only need to use it. I will list an smb. conf configuration on my local machine as follows:

[Global]
Workgroup = workgroup
Server String = % H server (Samba, UBUNTU)
DNS proxy = No
Log File =/var/log/samba/log. % m
Max log size = 1000
Syslog = 0
Obey Pam restrictions = Yes
Unix Password Sync = Yes
Passwd program =/usr/bin/passwd % u
Passwd chat = * enter \ snew \ s * \ spassword: * % N \ n * retype \ snew \ s * \ spassword: * % N \ n * password \ supdated \ ssuccessfully *.
Pam password change = Yes
Map to guest = bad user
Usershare allow guests = Yes
Username map =/etc/samba/smbusers
Security = user
; Guest OK = No
; Encrypt passwords = Yes
; Guest account = nobody

[Stonecao]
Comment = stonecao
Path =/home/stonecao
Writeable = Yes
; Browseable = Yes
Valid users = stonecao

Creat mask = 0777 // mask of the New File Permission under the shared directory in the window environment (that is, the original user permission and mask must be calculated to obtain the permission to create a file through sharing)

The above is one of my available configuration examples. The content in the corresponding/etc/samba/smbusers is as follows:

Stonecao = stonecao

5. After modifying the smb. conf file, we need to check whether our configuration has syntax errors. Run the following command:

Testparm

6. smbpasswd: Add a samba account

Smbpasswd [Options] [username]
-- 1. Add a samba account:
Smbpasswd-A stonecao // note that stonecao must be an existing Linux Account
-- 2. delete a samba account:
Smbpasswd-x stonecao
-- 3. Make an smaba account unavailable:
Smbpasswd-D stonecao
-- 4. Make an account available:
Smbpasswd-e stonecao

// For the moment, I have not figured out how to add a samba account with a different Windows user name and Linux User Name in smbpasswd. There is an option-u in it, but I have not tried it.

// When you use smbpasswd-a to add a samba user, you need to set a password. The password is the password used to access the samba shared directory in the window environment.

7. I installed a graphical Configuration tool before installation. I suggest using a graphical Configuration tool for simplicity. After all, we didn't study Samba:

-- 1. Use the graphical interface to add a samba User:

After System/System Management/samba is Enabled: preference/samba users you can add a samba User:

UNIX User: a Linux User, such as root
Windows User name: the user name you logged in to the samba shared directory.
Samba password; set the password for window access to the samba shared directory

-- 2. You can edit and delete users on the above page.

-- 3. Modify the preference/server configuration to the [Global] configuration item in smb. conf, but it is relatively simple.

8. after you change the user name or password, you may find that you are not allowed to access the Windows system due to an error. In this case, you need to disconnect the network ing and then re-access it to prompt you to re-enter the user name and password.

9. Access the samba shared directory in Windows: \ 192.168.112.129

 

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.