EXPORTFS command, FTP Introduction, FTP Introduction, use VSFTPD to build FTP service

Source: Internet
Author: User
Tags file transfer protocol

Exportfs command

The EXPORTFS command is used to manage the list of file systems for the current NFS share
-A all mount or uninstall all
-R Re-mount
-U Uninstalls a directory
-V Show shared directory
-F in "new" mode, refresh anything outside the kernel shared table. Any active client program will get a new shared entry Mountd added in their next request.
-V Output details. Shows what to do when sharing or canceling sharing. Displays the shared options at the same time as the current shared list.

You can use: Exportfs-arv This does not restart the NFS service, the configuration file will take effect

NFS Client Issues

When a client mounts a shared directory, whether it is a root user or a normal user, a new file is created with the owner and group nobody
There are two ways to solve this problem.
Client mount with-o nfsvers=3 specified nfsvers version 3
mount -t nfs -o nfsvers=3 192.168.71.131:/home/nfstestdir /mnt/

Both the client and the server need to change "#Domain = local.domain.edu" to "Domain = xxx.com" (xxx.com here, as defined here), and then restart the Rpcbind service

Introduction to FTP
    1. FTP is the abbreviation for the file Transfer Protocol (document Transfer Protocol), which is used to control the two-way transmission of files over the Internet.

    2. The primary role of FTP is to have the user connect to a remote computer (which runs an FTP server program), view the files on the remote computer, and then copy the files from the remote computer to the local computer, or transfer the files from the local computer to the remote computer.

    3. Small companies with many, large enterprises without FTP, because unsafe
Using VSFTPD to build an FTP service

Installing VSFTPD
yum install -y vsftpd

Create user virftp-s Specify login Shell,nologin indicates that the system cannot be logged in
useradd -s /sbin/nologin virftp

Edit a virtual user's password file
vim /etc/vsftpd/vsftpd_login

Write the following content customization can, odd behavior user name, even behavior password, multiple users write multiple lines, here the user name is TestUser1, password is testpasswd
testuser1
testpasswd

Set permissions
chmod 600 /etc/vsftpd/vsftpd_login

Convert a password file to a machine-recognized binary file
db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db

Create a configuration file for a virtual user
mkdir /etc/vsftpd/vsftpd_user_conf

Enter the directory
cd /etc/vsftpd/vsftpd_user_conf

Edit a user profile, the name of the file needs to be consistent with the user
vim testuser1

In the file, add the following content

local_root=/home/virftp/testuser1anonymous_enable=NOwrite_enable=YESlocal_umask=022anon_upload_enable=NOanon_mkdir_write_enable=NOidle_session_timeout=600data_connection_timeout=120max_clients=10

Local_root=/home/virftp/testuser1 define a virtual user's home directory
Anonymous_enable=no is used to limit whether anonymous accounts are allowed to log on (no means not allowed)
Write_enable=yes indicates writable
local_umask=022 umask Value
Anon_upload_enable=no Indicates whether anonymous accounts are allowed to upload files
Anon_mkdir_write_enable=no Indicates whether anonymous accounts are allowed to write
idle_session_timeout=600 How long time to disconnect after uploading files
DATA_CONNECTION_TIMEOUT=120 data transfer time-out
MAX_CLIENTS=10 the largest client

Create a virtual user's home directory
mkdir /home/virftp/testuser1
touch /home/virftp/testuser1/lx.txt

Change permissions
chown -R virftp:virftp /home/virftp

Define a password file
vim /etc/pam.d/vsftpd

Add the following line in front of the file
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

Edit VSFTPD's Master profile
vim /etc/vsftpd/vsftpd.conf

Change the following:
将anonymous_enable=YES 改为 anonymous_enable=NO
将#anon_upload_enable=YES 改为 anon_upload_enable=NO
将#anon_mkdir_write_enable=YES 改为 anon_mkdir_write_enable=NO#表示不允许创建目录

and add the following in the configuration file
chroot_local_user=YES
guest_enable=YES
guest_username=virftp#映射的是哪个普通用户
virtual_use_local_privs=YES#告诉服务使用的是虚拟用户
user_config_dir=/etc/vsftpd/vsftpd_user_conf
allow_writeable_chroot=YE

Start the service
systemctl start vsftpd

The FTP has been built, and the following tests are done:
Installing LFTP
yum install -y lftp

Log in to FTP using LFTP
lftp [email protected]
Password: #输入密码
lftp [email protected]:~> ls #可以看到之前创建的文件
-rw-r--r--1 1010 1010 0 Mar 14:57 Lx.txt
Upload a file using put to download a file using get exit using quit

EXPORTFS command, FTP Introduction, FTP Introduction, use VSFTPD to build FTP service

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.