What does Samba do in the first quarter? What's the use of it?
Samba (SMB is its abbreviation) is a Web server, which is one of the most important services of Linux as a local server for Linux and Windows shared files, and samba can be used for shared files between Windows and Linux. The same is true for shared files between Linux and Linux, but there is a better network file system for sharing files between Linux and Linux Nfs,nfs also need to set up a server;
2 , installation and service operation commands
Installing the Samba program is simple, using rpm-q Samba to see if the Samba software is already installed on the current system.
If not then enter the CD-ROM, RPM-IVH *samba*.rpm can be.
Carefully say the installed package:
samba-common-3.0.28-0.el5.8//samba The most basic files in the server and client
samba-3.0.28-0.el5.8//samba Server Core Package
System-config-samba-1.2.39-1.el5//samba Graphical Configuration interface
samba-client-3.0.28-0.el5.8//samba Client Software
Start, pause, and stop services:
/ETC/INIT.D/SMB start
/ETC/INIT.D/SMB stop
/ETC/INIT.D/SMB restart
Or
Service SMB Start
Service SMB Stop
Service SMB Restart
The second section, from the simplest example, is an anonymous user-readable and writable implementation
The first step: Change smb.conf
Let's implement one of the simplest features so that all users can read and write a folder shared by a Samba server; we need to change smb.conf; First you need to back up the smb.conf file;
[[email protected] ~]# cd /etc/samba
[Email protected] samba]# cpsmb.conf Smb.conf.bak
[Email protected] samba]# VI smb.conf or Geidt smb.conf &
Then we write the following paragraph into the smb.conf:
[global]
Workgroup = Workgroup
NetBIOS name = Liukai
Server string = Liukai ' s Samba server
security = share
[Test]
Path =/opt/test
writeable =yes
browseable = yes
guest OK = yes
notes:
[Global] This is the global configuration, is required to write the paragraph. which have the following lines;
Workgroup is the workgroup that is displayed in Windows, where I set the workgroup (in uppercase);
NetBIOS name is the name of the computer displayed in Windows;
Server string is the Samba server description that can be defined by itself; this is not important;
Security This is the authentication and login method, here we use share; there are many kinds of authentication methods, this is one of them; another commonly used is the user authentication method, if using share, it is not necessary to set the user and password;
[Test] This is displayed in Windows is a shared directory;
Path = You can set where the directory you want to share is placed;
Whether writeable can be written, here I set as writable;
Whether browseable can be browsed, can be browsed means that we can see the shared folder under the workgroup. If you do not want to show it, then set to browseable=no,guest OK Anonymous user as guest is logged in;
Step Two: Create the appropriate directory and authorize
[[email protected] ~]# mkdir -p /opt/test
[[email protected] ~]# id nobody
Uid=99 (nobody) gid=99 (nobody) groups=99 (nobody)
[[email protected] ~]# chown-r nobody:nobody/opt/test
Note: Regarding the authorization nobody, we first use the ID command to view the nobody user's information, found his user group is also nobody, we must take this as the prevail. Some systems nobody user groups are not nobody;
Step three: Start the server
Fourth step: access to Samba sharing of servers;
1 , in Linux You can use the following command to access;
[[email protected] ~]# smbclient -L //liukai
或 smbclient
192.168.0.94/test
Password: note: Press ENTER directly
2 , in Windows, you can use the following methods to access;
\\liukai or \\192.168.0.94
3
、说明:如果用了netbiosname,就可以用“\\主机名”来访问,如果没用netbiosname,就不能用主机名访问。
Section Three, simple password Authentication server
To modify the smb.conf file:
Security = User
Guest account = Liukai
Encrypt passwords = yes
SMB passwd file =/etc/samba/smbpasswd
Then, create a new user
Useradd Liukai
passwd Liukai
After success, CAT/ETC/PASSWD | Mksmbpasswd.sh >/etc/samba/smbpasswd
Smbpasswd-a Liukai
This succeeded in adding an SMB user.
Restart the service and use this user to log in.
Samba Server Lab Guide