Samba File Server setting "simplest"

Source: Internet
Author: User
Set the "simplest"-Linux Enterprise Application-Linux server application information for the samba file server. For more information, see the following section. The question is a joke. I am not a senior, but samba is a little eye-catching. In terms of principle, the app only aggregates the simplest implementations. After all, most people do not really create a file server, but simply share it with win.

Step 1: Install samba
# Apt-get install samba
# Apt-get install smbfs

Step 2: Add a linux User
# Useradd user1 // Add user1
# Passwd user1 // Add a password to user1
# Mkdir/home/user1 // create the home Directory of user1. this step is not required if you do not need this user name to log on to linux.
# Chown-R user1: user1/home/user1 // Set permissions for the home directory of user1

Step 3: Add a user to the samba server
Note: users logging on to samba must already be users in linux.
# Smbpasswd-a user1 // Add and set the samba password for user1

Step 4: Configure smb. conf
# Cd/etc/samb // enter the setting directory
# Mv smb. conf smb. conf. bak // back up the file and rename the default configuration file.
# Vim smb. conf // create and configure the smb. conf file

[Global]
Workgroup = x1 // X1 is the name of the Working Group in your LAN.
Server string = x2 // x2 is a descriptive text of your linux host, such as samba server.
Security = user // samba security level. user indicates that you need to enter the user name and password. If you change to share, you do not need to enter the user name and password.

[X3] // The x3 name in the box number can be obtained at will, but the shared folder name displayed in the win's network neighbor
Path =/home/x4 // x4 name of the folder to be shared. Create this folder before sharing and Set permissions for access.
Valid users = user1 // This x4 shared directory only allows this user to access
Public = no // no indicates that except the user1 user, other users cannot see the x4 directory after entering the samba server. If yes, although the x4 directory can be seen, however, the user except user1 can enter this directory, and others cannot.
Writable = yes // allow user1 to read and write data in the x4 directory; otherwise, no

// Save the disk and exit
# Testparm // check for syntax errors, such as spelling errors

Step 5: create a shared directory
# Mkdir/home/x4
# Chown-R user1: user1/home/x4 // because the directory is created by the root user, other users only have the read permission and must change the permission. Of course, you can also simply use # chmod 777/home/x4. Another problem is that if some files in the shared directory can be accessed and some files cannot be accessed, it must also be the permission problem. Go to/home/x4 and directly # chmod 777.

Step 6: restart the samba Service
#/Etc/init. d/samba restart

OK. The setting ends.

When setting the samba service, pay attention to the following two points (that is, two times ):

1. Add two users: add the System user # useradd user1 at a time; then add the samba user # smbpasswd-a user1;

2. Set twice the permission. One is to set the permission for the shared folder in smb. conf: the other is to set the permission for the shared folder in the system # chmod 777 folder name.

Author: zshmail
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.