Article Title: how to set up a Samba server and use User sharing ?. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
One theory:
In Windows, we all know that network neighbors are the way Windows shares resources. In Linux, The Samba service is used for mutual access and resource sharing. In fact, I think it is more like a software. Through Samba, Windows and Linux can share resources with each other, which is the relationship between servers and clients. For example, if a machine with a Windows operating system accesses a file from a machine with a Linux system, Windows should be a client, while Linux should be a server; if the Linux machine accesses and saves restricted files to Windows and uses the printing service provided by Windows, it should be said that Windows is a server, while Linux is a client.
Note:
1. If you cannot share a linux instance in windows, it may appear in your account. You must create a user with the same password on both linux and windows machines. Otherwise, it cannot be accessed.
2. If you are in a windows Network, you may not find linux sharing. We need to add our own network neighbors. The samba Host name of \ linux is the \ Share name Defined in netbios name. In this case, the novice brother may not understand it. I am not very professional either. Oh... Please take a closer look at \ linsir01 \ win02 in this post, and \ linsir01 \ share; \ linsir01 \ win03 and so on.
3. Add related protocols to windows. Add network protocols to add IPX, SPX, and NETBEUI protocols.
Operating Environment: three machines, two win2000 machines, and one RH80.
1. Check whether Samba has been installed in the system. This is also the procedure for installing other software. Note: Log On As root or run as root;
If the preceding three installation packages are not displayed, we need to find these packages in the drive to install them. Find all the samba files on the CD and put them in a temporary folder in linux. For example, we temporarily put it in the/tmp directory.
Then execute:
# Rpm-ivh samba *. rpm -- nodeps -- force
2. Then let's determine whether the samba service has been started. If not, we have to enable it.
Generally, samba is not started by default. But we should also know how to check whether the service is started. This is also a process of our operations. Run the following command to view the process:
# Ps-aux | grep smb
Here, we need to explain why we don't need the # ps-aux | grep samba command. We may understand it later. Now we can remember it. No, because the system service is smb, rather than samba, samba is just a name.
If you use the command to view the process, the second line appears. The samba service has been opened. If it does not appear, it is not opened.
If we do not open the samba service, we should use either of the following methods to open the system service.
1. run the setup command. When # setup is executed, there will be a System serverices, and then move the upper and lower keys on the keyboard to select the [System serverices] item, add the * sign before smb and swa to indicate that the two services have been selected. This means that the two services are automatically started. Alternatively, you can directly use the command to enter the [System serverices] selection box.
The two commands used in the above explanation are:
# Setup
Or
# Ntsysv
In this way, you can only open it, but if you do not restart it, the samba service cannot run. We also need to use commands to execute it, execute the samba service without restarting the machine. Generally, all the samba commands we want to operate are in/etc/rc. d/init. d/directory, use the following method to run.
#/Etc/rc. d/init. d/smb start
With the above command, if you can see the following prompt, it proves that samba has been started.
Start the SMB service: [OK]
Start NMB service: [OK]
Of course, you can also use the following method, just one more step, but enter/etc/rc. d/init. d/The directory can be used to check whether there is anything in it. If I am waiting for a cainiao, I can't help but look at it.
# Cd/etc/rc. d/init. d/
Then execute
#./Smb start
Then, how can we stop samba services? Then stop; restart the samba server, and restart it.
If it is in the/etc/rc. d/init. d directory, We need to execute
#./Smb stop
#./Smb restart
If it is not in the/etc/rc. d/init. d directory, we will execute it like this, as mentioned above.
Open the File Manager under mozilla, konqueror, and gnome. In short, you can open the file manager no matter how it is opened. In the address bar, enter
127.0.0.1: 901 a prompt box will appear [SWAT@127.0.0.1: 901]
Enter the root user name and password under the user name to enter the graphical configuration interface, which is relatively simple.
1] Click [Global] and an option is available for us to set. We only need to set this simply. If you do not know much about samba, we recommend that you do not change anything else. If you follow the steps I mentioned above
If there is a backup for the file, change it .. Haha .. There is nothing wrong with it. We can recover it again ..
Base Options
Client code page 936 displays the user group name in simplified Chinese.
[Workgroup] is the name of the Working Group in the [Windows Address] of the network neighbor. This item is MSHOME, because I also set the other two computers in this working group.
[Netbios name] This is the host name that appears in the network neighbor. The linsir01 I set is also supported by default. The real Linux host name is displayed.
[Security], set to user
[Encrypt passwords] set to yes
2] Click [shares]. Let's take a look. This is also important. I should pay attention to the following points. In fact, we use simple functions in the LAN. Simply set it.
Click [choose share]. There is a [homes] Option. Click... Then .... .. Let's take a look at the steps below. In fact, you don't have to change anything. Just take a look ..
The comment option can be left empty.
Path can also be left empty
Guest account nobody is the default value.
Valid users % S
Read only Yes
Guest OK No
3] creat share is for us to create shared directories and personal directories. Some may be puzzled. Why ?? Step by step .....
A. We create a win02 with a space on the edge of the [ceate share] button. Oh... Maybe you know, write win02 and click [create share].
Comment win02
Path/home/win02
Username win02
Guest accoun nobody
Valid users win02
Read only No
Guest OK No
Browseable Yes
Available Yes
B. Create win03 in the same way, and the directory is/home/win03
C. Then we create a directory that all users can view and share, that is, all users can write, read, and execute. I just used this directory as the base for installing windows machine software. Haha...
We enter share on [create share] As shown in step A above. For the name, we should not use too long; otherwise, the test will fail, it may be at most 8 bytes, so I will use the simplest one. Click.
Comment win and linux share
Path/share
Guest accoun nobody
Read only No
Guest OK Yes
Browseable Yes
Available Yes
That's all...
For printing, we should study printer on linux machines. I installed it successfully, but it is always garbled during windows Printing. So here I will not talk about how to set it. I have succeeded.
4] test whether the preparation file is correct
[Root @ linuxsir01 root] # testparm
Load smb config files from/etc/samba/smb. conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[share]"
Processing section "[win03]"
Processing section "[win02]"
Loaded services file OK.
Press enter to see a dump of your service definitions
If the above figure appears, it will be almost the same. If there is a warning or the like, the problem may occur in the [share] Step. The name may be too long and should not exceed 8 bytes. Otherwise, the connection fails.
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