Quick learning of Samba Server Settings Using experiments

Source: Internet
Author: User
Article Title: Experiment-based quick learning of Samba server settings. 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.
Samba is quite useful in windows and linux hybrid networks. This article uses experimental methods to quickly learn Samba.
  
[Lab project]
① Create a Samba server on linux and access it with an FTP-like client smbclient.
② Create a Samba server with security = user in linux and access it with a win2000 client.
③ Create a samba server with security = share on linux and access it with a win2000 client.
④ Mount samba sharing on linux.
  
   Tutorial 1: Create a Samba server on linux and access it with an FTP-like client smbclient.
  

[Lab requirements]
1. Two RH8.0 machines can ping each other.
2. IP address of machine 1: 192.168.0.1
3. IP address of Machine 2: 192.168.0.2
  
[Experiment steps]
1. Disable the firewalls of the two machines.
# Service iptables stop
# Chkconfig iptables off
  
2. install the software package on the two machines.
Check whether the samba, samba-common, and samba-client packages are installed.
# Rpm-q samba
# Rpm-q samba-common
# Rpm-q samba-client
Based on the results, find the software package that is not installed on the installation CD and start the installation.
# Rpm-ivh samba *. rpm
  
3. Enable the smb service on machine 1 and view the shared content.
# Service smb start
# Smbclient-L 192.168.0.1-N
  
4. Add a new user to machine 1.
# Useradd user1
# Passwd user1
Password: user1
# Touch/home/user1/iAmUser1
  
5. Create an smb account file in machine 1:/etc/samba/smbpasswd
# Touch/etc/samba/smbpasswd
# Smbpasswd-a user1
Password: user1
  
6. Back up the original configuration file in machine 1:/etc/samba/smb. conf
# Service smb restart
  
10. What does samba of machine 1 share on Machine 2?
# Smbclient-L 192.168.0.1-N
  
11. Access the samba service of machine 1 on Machine 2.
# Smbclient // 192.68.0.1/homes-U user1 % user1
  
12. After successfully accessing Machine 2, run the help Command.
Smb: \> help
Note: 1) Can I use ls to view the iAmUser1 file?
  
2) What is the difference between the comparison and FTP commands.
  
   Experiment 2: Create a Samba server with security = user on linux and access it with a win2000 client.
  

[Lab requirements]
1. One RH8.0 machine and one Win2k machine can ping each other.
2. RH8.0 host, IP: 192.168.0.1
3. Win2k server, IP Address: 192.168.0.2
  
[Experiment steps]
1. Modify/etc/samba/smb. conf on the basis of experiment 1.
Modifying the [global] section:
Workgroup = WORKGROUP1
------------------------
If you are familiar with the above changes, skip this section.
Workgroup = WORKGROUP1 is used to make linux and windows machines in the same working group.
------------------------
NOTE: If smb. conf is modified, you must run: service smb restart.
  
2. Modify the Working Group of Win2k to WORKGROUP1. If it is a domain controller, it must be downgraded to a general working group and used
Administrator restarts logon.
Modification Method: "My Computer" | "attribute" | "network ID" | "attribute"
  
3. On win2k, "Network Neighbor" | "entire network" | "all content" | "microsoft windows Network"
| "Workgroup1", do you see the machines in the RH system?
  
4. Enter user1 and user1 to enter. Can I create or delete a file?
  
   Experiment 3: Create a samba server with security = share on linux and access it with a win2000 client.
  

[Lab requirements]
1. One RH8.0 machine and one Win2k machine can ping each other.
2. RH8.0 host, IP: 192.168.0.1
3. Win2k server, IP Address: 192.168.0.2
  
[Experiment steps]
1. In Experiment 2 ??? S ?? ?? Success ?! Modify/etc/samba/smb. conf.
Append the following content:
[Public]
Comment = public
Path =/mnt
Browsable = yes
Public = yes
Modifying the [global] section:
Security = share
------------------------
If you are familiar with the above changes, skip this section.
[Public] defines another segment, which can also be another name.
Path indicates the shared directory.
Security uses share.
------------------------
NOTE: If smb. conf is modified, you must run: service smb restart.
  
2. log on to the win2k host using Administrator. "Network Neighbor" | "entire network" | "all content" |
"Microsoft windows Network" | "Workgroup1", do you see the machines in the RH system?
  
3. You can enter without a password, right? How many shared directories do you see? Can I write data?
  
4. Create an account user1 and password user1.
  
5. log out on win2k and switch to user1.
  
6. On win2k, "Network Neighbor" | "entire network" | "all content" | "microsoft windows Network"
| "Workgroup1", do you see the machines in the RH system?
  
7. You can enter without a password, right? How many shared directories do you see? Can I write data?
  
Note: 1) Can I write data after you modify the writable, create mode, and directory mode of the [public] segment in the [homes] segment?
  
2) what happens When you modify the/mnt/read/write permission of the RH8.0 host to drwxrwxrwx?
  
   Experiment 4: Mount samba sharing on linux.
  
[Lab requirements]
1. One RH8.0 machine and one Win2k machine can ping each other.
2. RH8.0 host, IP: 192.168.0.1
3. Win2k server, IP Address: 192.168.0.2
  
[Experiment steps]
1. Share C:
2. Run on RH8.0:
# Smbclient // 192.168.0.2/C-U win2k's current login username % Password
Note: Can I log on?
  
3. Mount the shared Disk:
# Mount-t smbfs-o username = Current login name % password of win2k
// 192.168.0.2/C/mnt/cdrom
  
Note: 1) do not have spaces between "username = win2k's current login name % password.
  
2) also available: # smbmount // 192.168.0.2/C/mnt/cdrom-o username =
Username = win2k's current login name % Password
  
3) also available: # smbmount // 192.168.0.2/C/mnt/cdrom-U
Current login username of win2k
Enter the password.
  
4) In reality, both are Linux systems, one as the samba server and the other as the client. For example
In the case of lab 1, on machine 2:
# Mount-t smbfs-o username = user1 % user1
// 192.168.0.1/homes/mnt/cdrom
It can also achieve sharing, but it is not necessary. In linux, nfs can be used for sharing, and the speed is faster than Samba.
  
[Experiment Summary]
  
This article is just a simple and quick learning of Sabma. If you want to learn more, you need to combine manpage with the original/etc/samba/smb. conf (smb. conf. BAK). In addition,/usr/share/doc/samba provides professional documents for you to learn. However, the study in this article has basically met the general work needs. As security is in the domain and server Format, I have not studied it, so it is not involved.

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.