Use Samba to configure the file sharing server in RHEL5.4

Source: Internet
Author: User

To use Samba to configure a file sharing server in RHEL5.4, follow these steps:

1. Install samba server software
View the Samba components currently installed in the system:
Rpm-qa | grep samba
Insert the RHEL5 system disk, mount and view samba-related software packages:
Attach a CD:
Mount/dev/cdrom/media/
View samba-related software packages:
Ls/media/Server/* samba *


To install the samba server software, you must install at least three packages: samba, samba-client, and samba-common to implement the basic functions of the samba server and client:
Rpm-ivh/media/Server/samba-client-3.0.33-3.14.el5.i386.rpm
Rpm-ivh/media/Server/samba-common-3.0.33-3.14.el5.i386.rpm
Rpm-ivh/media/Server/perl-Convert-ASN1-0.20-1.1.noarch.rpm
Rpm-ivh/media/Server/samba-3.0.33-3.14.el5.i386.rpm


2. View installed directories and files
Rpm-ql samba
Rpm-ql samba-client

/Etc/main directory for storing samba configuration files
/Etc/samba/smb. conf main configuration file
/Etc/samba/smbpasswd samba account file
/Etc/samba/lmhosts configuration file parsed by netbios
The pam Configuration File of/etc/PAM. d/samba
/Etc/rc. d/init. d/smb Startup Script File
/Etc/samba/smbusers samba user ing
/Usr/bin/smbstatus to view the connection status of the samba server
/Usr/sbin/nmbd samba Application
/Usr/sbin/smbd samba Application
/Usr/bin/smbclient samba client access tool
/Usr/bin/smbmount samba client mounting tool

3. samba Server Control
Start the samba service:
Service smb start
View the smbd and nmbd processes running in the background:
Ps-aux | grep [sm, nm] bd

4. view the valid configuration list of the main configuration file of the samba server
Grep-v "^ #"/etc/samba/smb. conf | grep-v "^;" | grep-v "^ $"

############################### Shard line samba user account #### #######################
Case 1: Create a samba user account and test homes sharing
(1) create a samba User Account
Useradd Username
Passwd User Name
Smbpasswd-a user name
Important:
Smbpasswd command
Smbpasswd-a creation
Smbpasswd-d disabled
Smbpasswd-e Enabled
Smbpasswd-x Delete
(2) access the UNC path of the samab server through the client
(3) log on to the samba server through the newly created samba user account on the client for testing.
(4) Result: user Access is your home directory ################################## split line create an anonymous File Sharing ###########################
Tutorial 2: Modify the security level of the samba server
(1) modify the main configuration file smb. conf
Vi/etc/samba/smb. conf
Security = share
Netbios name = NETBIOS
Socket options = TCP_NODELAY SO_RCVBUF = 8192 SO_SNDBUF = 8192



The performance optimization Parameter must exist. You can modify the variable according to the memory and cache.
(2) restart the smb service
Service smb restart
(3) test through UNC path on the client
Result: anonymous users can access the samba File Sharing server.


################################ Create a public directory for the splitting line (create a file server) shared directory) case 1 ###########################
(1) create a directory to be shared
Mkdir-p/var/share
Cd/var/share
Mkdir public training devel
Chown root.net devel
Chmod 775 devel
Ls-ld devel
(2) establish relevant system users, groups, and add samba users
Useradd yun01 add normal employee account yun01
Groupadd tech add tech
Groupadd net add Project Group net
Useradd-g tech tec01
Useradd-g net-G tech ben01
Smbpasswd-a yun01
Smbpasswd-a tec01
Smbpasswd-a ben01
Smbpasswd-a root
(3) User ing
Vi/etc/samba/smbusers
Root = admin confirm that there is a root-> admin name ing
(4) modify the smb. conf configuration file and add sharing settings.
Vi/etc/samba/smb. conf
[Global]
Security = share confirm this option
Username map =/etc/samba/smbusers confirm that this item exists
[Public]
Comment = public directory
Path =/var/share/public
Public = yes
Read only = yes
[Peixun]
Comment = technical information
Path =/var/share/training
Public = no
Read only = yes
Valid users = root, @ tech
[Kaifa]
Comment = development data
Path =/var/share/devel
Public = no
Read only = no
Valid users = root, @ net, @ tech
Write list = root, @ net
Directory mask = 0774
Creat mask = 0660
(5) restart the smb service
Service smb restart
(6) Verify the experiment results
Use samba users yun01, tec01, ben01, admin, and anonymous to log on to the shared directory.
Note:
If you use a windows client for verification, You need to execute the net use */delete command every time you switch between users.
Clear connection cache.


5. Use the samba client Tool
Method 1:
Smbclient Tool
1. smbclient-L 192.168.100.1
View shared resources (Default User: anonymous)

2. smbclient-L 192.168.100.1-U samba Username

3. smbclient // 192.168.100.1/gongxiang

4. Can smbclient be used? View All smbclient commands

Method 2:
Smbmount Tool
1. Create a mounted directory on the client
Mkdir/file
2. smbmount // 192.168.100.1/gongxiang/file
You can mount the shared resources of the remote samba server to the local device.
3. smbumount mount point


Method 3:
Mount command

Mount-t smbfs // 192.168.100.1/gongxiang/file
Umount/file

Method 4:
Modify the/etc/fstab configuration file
Vi/etc/fstab
// 192.168.100.1/gongxiang/file smbfs defaults 0 0


############################### Install and use swat in a GUI ###########################
(1) install swat
Ls/media/Server/* swat *
Rpm-ivh/media/Server/samba-swat-3.0.33-3.14.el5.i386.rpm
(2) modify the xinetd configuration file to allow access from the client. Otherwise, only local access is allowed.
Vi/etc/xinetd. d/swat
Modify project: only_from = 127.0.0.1
Set the IP address of the client that is allowed to access

Restart the xinetd service
Service xinetd restart
(3) access through a browser on the client:
Http: // 192.168.100.1: 901

 

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.