The entire process of setting up samba servers in linux must be refined.

Source: Internet
Author: User
The entire process of setting up samba servers in linux requires the addition of Linux Enterprise Application-Linux server application information. The following is a detailed description. I recently learned how to set up a linux samba server in linux.
The local machine is a virtual machine and winxp for testing. The virtual machine address is 192.168.1.144 and the host address is 192.168.1.10. The two can communicate with each other.
First, we first configure
I. First, check whether smb is installed in linux.
[Root @ localhost zy] # rpm-qa | grep samba
Samba-2.2.5-10
Samba-swat-2.2.5-10
Samba-common-2.2.5-10
Samba-clients-2.2.5-10
I won't say much about the installation of the Local Machine. If it is not installed, find a CD to install it.
2. Then, let's determine whether the samba service has been started,
[Root @ localhost zy] # ps-aux | grep smb
Root 1719 0.0 0.3 4916 1820? S smbd-D
Root 1849 0.0 0.1 4776 628 pts/1 S grep smb
If it is not started, use [root @ localhost zy] #/etc/init. d start
If it is disabled, it is [root @ localhost zy] #/etc/init. d stop
Restart [root @ localhost zy] #/etc/init. d start
This is only the current startup. If you need to start it every time
Use setup or ntsysv
3. The local machine does not have a firewall installed in linux. If the firewall causes mutual access failure
[Root @ localhost zy] #/sbin/iptables-F
4. Configure smb's main configuration file smb. conf
[Root @ localhost zy] # cd/etc/samba
[Root @ localhost samba] # mv smb. conf smb. confbak
Then we will recreate an smb. conf file.
[Root @ localhost zy] touch smb. conf
Then we write the following section into smb. conf.
[Global]
Workgroup = workgroup
Netbios name = zy
Server string = Linux Samba Server
Security = user
Vaild user = zhaoyong
[Zy]
Path =/home/zy
Writeable = yes
Browseable = yes
Create mask = 0664
Guest OK = yes
[Global] This section is a global configuration and is mandatory.
Workgroup is the working group displayed in Windows. Here I am still working group
Netbios name is the computer name zy displayed in Windows.
Server string is the Samba server description, which can be defined by yourself; this can be omitted
Security: This is the authentication and login method. Here we use uesr. There are many authentication methods, which are one of them. If we use share, we don't need to set the user and password;
[Zy] the shared directory is displayed in Windows;
Path = You can set where the directory to be shared is stored;
Whether writeable can be written. Here I set it to writable;
Whether browseable can be viewed or not. If browsed, we can see shared folders under the Working Group. If you do not want to display it, set it to browseable = no.
Create mask is the permission mask used to create files. It is readable and writable to users, readable to user groups, and readable to other users;
Guest OK anonymous users log on as guest;

5. File authorization and User Creation
[Root @ localhost zy] # useradd zhaoyong
[Root @ localhost zy] # passwd 123456
[Root @ localhost zy] # create a directory by mkdir-p/home/zy
[Root @ localhost zy] # chmod 755/home/zhaoyong change Directory Permissions
[Root @ localhost zy] # chown zhaoyong/home/zhaoyong change the directory owner to zhaoyong
[Root @ localhost zy] #/usr/sbin/groupadd workgroup create user group workgroup
[Root @ localhost zy] # gpasswd-a zhaoyong workgroup add zhaoyong to the workgroup of the user group
6. Add a samba user and set the password;
The method we use is to add users first, but these users are all virtual users, because these users cannot log on to the system through SHELL;
In addition, it is worth noting that the password of the System user is different from that of the Samba user. If you have set a system user to log on to SHELL,
You can set the Samba password of a user to be different from the password of a system user logging on through SHELL.
We use smbpasswd to add Samba users and Set passwords.
[Root @ localhost zy] # smbpasswd-a zhaoyong
New SMB password: 123456 Add the password of Samba user zhaoyong here;
Retype new SMB password: 123456 re-input;
7. We can use finger to view user information.
[Root @ localhost zy] # finger zhaoyong
If the directory is not/home/zhaoyong
We need to modify the directory usermod-d/home/zhaoyong
Start the samba server
[Root @ localhost zy] #/etc/init. d restart
8. windows machine settings.
1. Create a user and password for windows.
Because we set the user Sharing Mode in [Global], that is, we should use the windows user name for verification. Note: In windows, you must set a user with the same password as that on a linux server. It is recommended that a user with the username Zhao Yong have a password of 123456 and the Working Group have a workgroup.
This method is used for samba password service verification. We have created a system username and password for zhaoyong on the linux server and an smb password.
2. Add related protocols to windows. Add the network protocols IPX, SPX, and NETBEUI.
9. Access.
Access the smb server from linux, [root @ localhost zy] # smbclient-L // 192.168.1.144-U zhaoyong
Password: 123456 enter the Password
Access from windows can be accessed from workgroup Working Groups in network neighbors, or \ 192.168.1.144 can be accessed directly in a browser.
Appendix smbclient commands
Switch the cd [Directory] to the specified directory on the server. If not, smbclient returns the current local directory.
Switch the LCD [Directory] to the specified directory on the client;
Dir or ls to list files in the current directory;
Exit or quit to exit smbclient
Get file1 file2 downloads file1 from the server and stores it on the local machine with the file name file2. If you do not want to change the name, you can omit file2.
Mget file1 file2 file3 filen downloads multiple files from the server;
The md or mkdir directory is used to create a directory on the server.
Rd or rmdir directory Delete the directory on the server
Put file1 [file2]: upload a file file1 to the server and upload it to the server;
Mput file1 file2 filen upload multiple files to the server
Mounting the smbfs File System in Linux;
Mount usage: load the shared folder in the network to the local machine. mount is used to mount the file system. SMB can also be used as a network file system; smbmount is also a variant of mount;
Smbmount-o username = zhaoyong, password = 123456,-l // 192.168.1.10/Shared Folder name mount point
Smbmount // ip address or computer name/Shared Folder name mount point
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.