Linux 基础 —— 文件共享服务 FTP,NFS 和 Samba

One, the establishment of samba sharing, shared directory for /data, requirements:

1)The share name is shared, the working group for the MYDATA, can be viewed; 2) adding group develop, add Gentoo, CentOS and Ubuntu, where Gentoo and CentOS with develop as the additive group, 
Ubuntu does not belong to the develop group; password are user name; 3) add Samba user Gentoo, CentOS and Ubuntu, The password is "Samba"; 4) the samba shared shared only allows develop group has write permissions, Other users can only access to read-only; 5) the samba shared service only allows host access from the 192.168.1.0/24 network,

# Note, all of the following configuration is done in the same it in the machine, CentOS6.5 system

# A, install the software

yum install samba -y

# Two, to the user

groupadd develop
useradd -G develop gentoo
useradd -G develop centos
useradd ubuntu
echo "gentoo" | passwd gentoo --stdin
echo "centos" | passwd centos --stdin
echo "ubuntu" | passwd ubuntu --stdin
echo -e "samba\nsamba" | smbpasswd  -a gentoo -s
echo -e "samba\nsamba" | smbpasswd  -a centos -s
echo -e "samba\nsamba" | smbpasswd  -a ubuntu -s

If not smbpasswd -a USER ‘xxxx’

Mkdir /data

setfacl -m g:develop:rwx /data/

The main configuration file modification

vim /etc/samba/smb.conf

wps_clip_image-15518

wps_clip_image-31898

Restart

wps_clip_image-17584

Test

wps_clip_image-15521

The test of sharing

wps_clip_image-9878

User testing

wps_clip_image-2681

Vsftp

Two, vsftp service

Vsftp is really Linux FTP to achieve linux–windows data transmission between, this service is transmitted in plaintext information, not safe

Program installation

yum -y install vsftpd mysql-server
/etc/logrotate.d/The vsftpd log
/etc/pam.d/Vsftpd key authentication
/etc/rc.d/init.d/The vsftpd startup script
/etc/vsftpd/Ftpusers saves the user
/etc/vsftpd/The user_list users list
/etc/vsftpd/The vsftpd.conf configuration file
/var/ftp/The pub home directory

The default installation allow anonymous users to download, other permissions are not, you can start the installation is finished, the default program is FTP,

Linux server to create the file

wps_clip_image-4411

Windos view

wps_clip_image-24230

Download CMD and change directory, can help help

wps_clip_image-9851

A modified configuration document

Anonymous user configuration:

Anonymous_enable=YES allow anonymous users to access
Anon_upload_enable=YES opens the upload function
Anon_mkdir_write_enable=YES can create, modify permissions
Other anon_ohter_write_enable=YES users also have the upload and download of Quax
Users of the system configuration: 
Local_enable=YES local user can log on
Write_enable=YES can write
The local_umask=022 default file permissions
Imprison all FTP local user on the home directory: 
chroot_local_user=YES
FTP local user specified imprisons the file on the home directory: 
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/Chroot_list the user people write in this file, batch to imprisonment
Journal: 
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/var/log/xferlog
Change the file owner: 
Chown_uploads=YES allows to upload
chown_username=whoever
Vsftpd uses PAM to complete the user authentication, the use of the PAM configuration file: 
pam_service_name=vsftpd
Whether to enable the control user list file
userlist_enable=YES
userlist_deny=YES|NO
The default file/etc/vsftpd/user_list
Connection limit: 
Max_clients: maximum number of concurrent connections, 
The number of concurrent requests per IP also launched max_per_ip:, 
Transmission rate: 
The maximum transmission rate of anon_max_rate: anonymous users, the unit is "byte / sec";
Local_max_rate: local user login for the most

Actual intersection user permissions = directory and user rights

Experiment

Mkdir /var/ftp/pub/book
Setfacl -m u:ftp:rwx book
Vim /etc/etc/vsftpd/vsftpd.conf
Anonymous_enable=YES allow anonymous users to access
Anon_upload_enable=YES opens the upload function
Anon_mkdir_write_enable=YES can create, modify permissions
Other anon_ohter_write_enable=YES users also have the upload and download of Quax
Useradd gentoo
Passwd  Gentoo

The Gentoo upload download modify all permissions directory inside the book sharing, taking into account the security server that even the best

Set the ciphertext transmission information, or limit the number of asphalt etc.

Nfs

Three, nfs

Yum install nfs-utils -y

Linux–linux–windos–unix

Virtual machine: the NFS server IP address: 192.168.1.146

Virtual machine two: client IP address: 192.168.1.143

Vmware1

Yum install nfs-utils -y
Vim /etc/exports
User   192.168.1.163(rw)
Showmount  -e  ip

wps_clip_image-32557

Vim /etc/exports

Set sharing to the users, permissions

wps_clip_image-25399

Mount -t nfs ip :/sharename /Catalog

Vmware2

wps_clip_image-12457

Nfs is using uid to identify the user.

Add a specified uid user on the server, the server to add a uid and server as the same user and user name is not the same,

This setting permissions, specify the user has access to, we went to the same server user client authentication, and people do not have access to,

But uid the same username different can access, which indicates that the NFS set user access is by uid to control access.

Four, experiment

Schematic diagram

Order a NFS service file sharing service, DNS, for two web servers, providing a forum Webpage preservation, reach users log on different hosts

On the IP with a website, achieve the basic information of the user, the invariant

wps_clip_image-20436

Web1 environment installed

Lamp environment to build

Yum install httpd php php-mysql php-gd mysql-server -y

Vim /etc/httpd/conf/httpd.conf

Notes

1, The main directory

wps_clip_image-16189

2, Comment out the list

wps_clip_image-8181

3, The new virtual host

wps_clip_image-28643

4, service httpd restart

5, Database installation authorization

wps_clip_image-27910

Service mysql restart

Mount NFS

Check there is no share to you, there is no authority

Showmount -e 172.16.1.13

Mount

Mount -t nfs 172.16.1.13: /share/data

To view the file sharing

wps_clip_image-9547

Install WordPress

This themselves to the official website to download here won’t show.

Another configuration and the same configuration, should pay attention to things and authorization, authorization to user is connected to the local MySQL

The NFS server is set

Install NFS

Yum install nfs-utils -y

Service nfs restart

Vim/etc/exports

wps_clip_image-18974

Showmount -e 172.16.1.140

Service nfs restart

The word press on the /share/data, and then go to where the client to see if

Entering a site editor

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>