14.4 exportfs command 14.5 NFS client problem 15.1 FTP introduction 15.2/15.3 Use vsftpd to build ftp

exportfs command

Common options

 -a mount all or unmount all

 -r remount

 -u unmount a directory

 -v show shared directory

 

[root@anan-03 mnt]# umount /mnt

umount.nfs4: /mnt: device is busy

[root@anan-03 mnt]# cd

[root@anan-03 ~]# umount /mnt

 

 The following operations are performed on the server

vim /etc/exports //Increase

/tmp/ 192.168.174.130(rw,sync,no_root_squash)

 exportfs -arv //The configuration file will take effect without restarting the nfs service

[root@localhost ~]# exportfs -arv

exporting 192.168.174.130:/tmp

exporting 192.168.174.0/24:/home/nfstestdir

 

[root@anan-03 ~]# showmount -e 192.168.174.128

Export list for 192.168.174.128:

/home/nfstestdir 192.168.174.0/24

/tmp             192.168.174.130

 mount -t nfs 192.168.174.128:/tmp/ /mnt

 

[root@localhost ~]# ls -l /tmp/123.txt

-rw-r--r--. 1 root root 15 1月   6 22:14 /tmp/123.txt

 

Client file owner belongs to group nobody

NFS 4 version will have this problem

 After the client mounts the shared directory, whether it is a root user or a common user, when creating a new file, the owner and group are nobody

 Add -o nfsvers=3 when the client is mounted

mount -t nfs -o nfsvers=3 192.168.174.128:/tmp/  /mnt

mount -t nfs -oremount,nfsvers=3 192.168.174.128:/tmp/  /mnt

 Both client and server need

 vim /etc/idmapd.conf 

// Change "#Domain = local.domain.edu " to "Domain = xxx.com " ( xxx.com here , define it at will), and then restart the rpcidmapd service

Introduction to FTP

FTP is the English abbreviation of File Transfer Protocol (File Transfer Protocol, referred to as File Transfer Protocol), which is used to control the bidirectional transmission of files on the Internet.

 The main function of FTP is to allow users to connect to a remote computer (the FTP server program is running on these computers), view the files in the remote computer, and then copy the files from the remote computer to the local computer, or transfer the files of the local computer to the remote computer. computer.

 Small companies use FTP more, but large companies do not use FTP because it is not secure.

 

Use vsftpd to build ftp service

Comes with vsftpd on centos

 yum install -y vsftpd

 useradd -s /sbin/nologin virftp

 vim /etc/vsftpd/vsftpd_login //The content is as follows, the odd number is the username, the even number is the password, multiple users write multiple lines

 

testuser1

123123

 

 chmod 600 /etc/vsftpd/vsftpd_login

 db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db

 mkdir /etc/vsftpd/vsftpd_user_conf

 cd /etc/vsftpd/vsftpd_user_conf

 

 

Use vsftpd to build ftp service

vim testuser1 //Add the following content

 

local_root=/home/virftp/testuser1

anonymous_enable=NO

write_enable=YES

local_umask=022

anon_upload_enable=NO

anon_mkdir_write_enable=NO

idle_session_timeout=600

data_connection_timeout=120

max_clients=10

 

mkdir /home/virftp/testuser1

 touch /home/virftp/testuser1/aming.txt

 

 chown -R virftp:virftp /home/virftp

 vim /etc/pam.d/vsftpd //Add at the top

auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

 

 cat /etc/pam.d/vsftpd

 

vim /etc/vsftpd/vsftpd.conf

 Change anonymous_enable=YES to anonymous_enable=NO

 Change #anon_upload_enable=YES to anon_upload_enable=NO

 将#anon_mkdir_write_enable=YES 改为 anon_mkdir_write_enable=NO

  Add the following

pam_service_name=vsftpd

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=YES

setenforce 0

 systemctl start vsftpd //Start vsftpd service systemctl restart vsftpd.service

 ps aux |grep vsftpd 

netstat -lntp

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327082773&siteId=291194637