Samba File Server installation and configuration tutorial

Source: Internet
Author: User
Tags server installation and configuration
Samba File Server installation and configuration tutorial-Linux Enterprise Application-Linux server application information, the following is a detailed description. Install the samba package
First Disc
# Mount/mnt/cdrom
# Cd/mnt/cdrom/RedHat/RPMS/
# Ls | grep samba
Redhat-config-samba-1.0.4-1.noarch.rpm
Samba-2.2.7a-7.9.0.i386.rpm
Samba-client-2.2.7a-7.9.0.i386.rpm
Samba-common-2.2.7a-7.9.0.i386.rpm
# Rpm-ivh samba-common-2.2.7a-7.9.0.i386.rpm
# Rpm-ivh samba-client-2.2.7a-7.9.0.i386.rpm
# Rpm-ivh samba-2.2.7a-7.9.0.i386.rpm
# Rpm-ivh redhat-config-samba-1.0.4-1.noarch.rpm
# Cd; eject
# Service smb start
Note: The following test/192.168.60.110 is a windows computer in the LAN.

*******************
Samba client commands

# Smblookup test // resolve the IP address of test
# Smblookup \ * // resolve the ip addresses of all hosts in the LAN
# Smbclient-L test/192.168.60.110 // view the target host sharing list
# Smbclient-L 192.168.60.110-U administrator // use the specified user to view the sharing list
# Smbclient // 192.168.60.110/share // log on to the share directory of the target host
# Smbclient // 192.168.60.110/share-U www % www // access the share directory of the server with the specified user and password
Smb> get sn.txt // download the sn.txt file on the Remote Desktop to the local directory
Smb> put/root/install. log install. log // you must specify the target directory and name of the merchant ship.
Smb> quit
# Smbmount // 192.168.60.110/www/mnt/smb-o username = www % www // mount the www shared directory to the local/mnt/smb directory, users can use Remote sharing like using local directories, similar to disk ing in windows.
# Umount/mnt/smb // uninstall/mnt/smb directory

**************
Samba server settings

1. Create a shared directory for anonymous access
Vi/etc/samba/smb. conf
Security = share

[Docs]
Path =/usr/share/doc
Comment = share docs
Public = yes
# Service smb restart // restart the smb service
# Smbclient-L localhost // Test
And Test on windows

2. Create a shared directory based on user authentication
Vi/etc/samba/smb. conf
[Huyb]
Comment = huyb 'files
Path =/var/huyb
Public = no
Writable = yes
Valid users = huyb
# Useradd huyb
# Smbpasswd-a huyb
# Mkdir/var/huyb
# Chown huyb. huyb/var/huyb

Iii. Case configuration ---- implement the following tasks
Task 1: The server uses user authentication. Each user can access his/her home directory, and only the user can access the home directory with full permissions, others cannot see your home directory;
Task 2: Create a caiwu folder. You can see the folder in the caiwu group and lingdao group, but only caiwu has the write permission;
Task 3: Create a lindao directory. Only leaders can access and read/write the directory, and netadmin can also access the directory, but outsiders cannot see the directory;
Task 4: It is recommended to exchange a file exchange Directory, which can be read and written by all users, including guest users. However, no one can delete others' files;
Task 5: It is recommended that a public read-only folder be public, and everyone should read the content of this folder;

Prerequisites: Create related accounts and groups.
# Groupadd caiwu
# Groupadd lingdao
# Groupadd network
# Useradd-g caiwu
# Useradd-g caiwu caiwu01
# Useradd-g caiwu caiwu02
# Useradd-g network netadmin
# Useradd-g network net01
# Useradd-g network net02
# Useradd-g lingdao
# Useradd-g lingdao lingdao01

Add all users to the smbpasswd file through "smbpasswd-a user name;
Create related directories and SET related properties;

# Mkdir/var/samba/caiwu
# Chown caiwu. caiwu/var/samba/caiwu
# Mkdir/var/samba/exchange
# Chmod-R 1777/var/samba/exchange
# Mkdir/var/samba/lingdao
# Chown lingdao. lingdao/var/samba/lingdao
# Mkdir/var/samba/public

Modify configuration file
# Vi/etc/samba/smb. conf
Security = user
[Homes]
Comment = Home Directories
Browseable = no
Writable = yes
Valid users = % S
Create mode = 0664
Directory mode = 0775
[Public]
Comment = caiwu
Path =/var/samba/public
Public = yes
[Caiwu]
Comment = caiwu
Path =/var/samba/caiwu
Public = no
Valid users = @ caiwu, @ lingdao, netadmin
Write list = caiwu
Printable = no
[Lingdao]
Comment = lingdao
Path =/var/samba/lingdao
Public = no
Browseable = no
Valid users = @ lingdao, netadmin
[Exchange]
Comment = Exchange
Path =/var/samba/exchange
Public = yes
Writable = yes
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.