14.1 NFS Introduction
- NFS is an abbreviation for the network File system
- NFS was first developed by Sun, 2,3,4 three editions, 2 and 3 were drafted by Sun, and 4.0 began to be involved and led by NetApp, with the latest version of 4.1
- NFS data transfer is based on RPC protocol, RPC is a shorthand for remote Procedure call.
- The NFS Application scenario is: A,b,c three machines need to ensure that the files are accessed is the same, a shared data out, B and C respectively to mount A shared data directory, so B and C access to the data and a consistent
- NFS schematic diagram
14.3 NFS server-side installation configuration
Installing NFS
[[email protected] ~]# yum install -y nfs-utils rpcbind
Edit an NFS configuration file
[[email protected] ~]# vim /etc/exports/home/nfstestdir 192.168.248.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000)
After you save the configuration file, perform the following preparation actions
[[email protected] ~]# mkdir /home/nfstestdir[[email protected] ~]# chmod 777 /home/nfstestdir[[email protected] ~]# systemctl start nfs[[email protected] ~]# systemctl enable nfs[[email protected] ~]# setenforce 0[[email protected] ~]# firewall-cmd --add-service=nfs
Client
View files shared by the server
[[email protected] ~]# yum install -y nfs-utils[[email protected] ~]# showmount -e 192.168.248.10 //该ip为NFS服务端ip[[email protected] ~]# mount -t nfs 192.168.248.10:/home/nfstestdir /mnt
14.3 NFS Configuration options
- RW Read/write
- RO Read Only
- Sync sync mode, memory data is written to disk in real time
- Async non-synchronous mode
- No_root_squash Client Mounts NFS shared directory, the root user is not constrained and permissions are large
- Root_squash with the above option, the root user on the client receives a constraint that is limited to a normal user
- All_squash all users on the client are limited to an ordinary user when using the NFS shared directory
- Anonuid/anongid is used with the above options to define the UID and GID of the qualified user
14.4 Exportfs Command
- -A all mount or uninstall all
- -R Re-mount
- -U Uninstalls a directory
- -V Show shared directory
Server-Side Modification configuration
[[email protected] ~]# vim /etc/exports.../tmp/ 192.168.248.0/24(rw,sync,no_root_squash)[[email protected] ~]# exportfs -arv //不用重启nfs服务,配置文件就会生效
14.5 NFS Client Issues
- CentOS 6 and NFS 4 versions will have this problem
- 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
Method One:
Add-o nfsvers=3 when client mounts
Method Two
Both the client and the server need
vim /etc/idmapd.conf //把“#Domain = local.domain.edu” 改为 “Domain = xxx.com” (这里的xxx.com,随意定义吧),然后再重启rpcidmapd服务
15.1 FTP Introduction
- 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.
- 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.
- Small companies with many, large enterprises without FTP, because unsafe
15.2/15.3 using VSFTPD to build FTP
Install FTP
[[email protected] ~]# yum install -y vsftpd
Virtual user mode
Create a user database file for FTP authentication, where odd-numbered account names, even-numbered behavior passwords
[[email protected] ~]# cd /etc/vsftpd/[[email protected] vsftpd]# vim vuser.listzhangsanaaalisibbb
You need to use the Db_load command to convert the original plaintext information file into a database file with a hash (hash) algorithm, and to reduce the permissions of the database file
[[email protected] vsftpd]# db_load -T -t hash -f vuser.list vuser.db[[email protected] vsftpd]# file vuser.dbvuser.db: Berkeley DB (Hash, version 9, native byte-order)[[email protected] vsftpd]# chmod 600 vuser.db[[email protected] vsftpd]# rm -f vuser.list
Modify the FTP configuration file
[[email protected] ~]# useradd -s /sbin/nologin ftp[[email protected] ~]# mkdir /etc/vsftpd/vsftpd_user_conf[[email protected] ~]# cd /etc/vsftpd/vsftpd_user_conf[[email protected] ~]# vim testuser1local_root=/home/ftp/testuser1anonymous_enable=NOwrite_enable=YESlocal_umask=022anon_upload_enable=NOanon_mkdir_write_enable=NOidle_session_timeout=600data_connection_timeout=120max_clients=10[[email protected] ~]# mkdir /home/ftp/testuser1
Modifying the PAM configuration file
[[email protected] ~]# vim /etc/pam.d/vsftpd //在最前面加上auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vuseraccount sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser
[[email protected] ~]# vim /etc/vsftpd/vsftpd.conf将anonymous_enable=YES 改为 anonymous_enable=NO将#anon_upload_enable=YES 改为 anon_upload_enable=NO 将#anon_mkdir_write_enable=YES 改为 anon_mkdir_write_enable=NO再增加如下内容chroot_local_user=YESguest_enable=YESguest_username=virftpvirtual_use_local_privs=YESuser_config_dir=/etc/vsftpd/vsftpd_user_confallow_writeable_chroot=YES
Windows can use the FileZilla client
Linux can use Lftp
[[email protected] ~]# yum install -y lftp[[email protected] ~]# lftp [email protected] //然后输入密码即可,?可以查询可用命令
15.4 Xshell using XFTP to transfer files
Download Xftp, install
Use Xshell to log in to the server and press Ctrl+alt+f to use it
15.5 using PURE-FTPD to build FTP service
[[email protected] ~]# yum install -y epel-release[[email protected] ~]# yum install -y pure-ftpd[[email protected] ~]# vim /etc/pure-ftpd/pure-ftpd.conf//找到pureftpd.pdb这行,把行首的#删除PureDB /etc/pure-ftpd/pureftpd.pdb[[email protected] ~]# systemctl start pure-ftpd[[email protected] ~]# mkdir /data/ftp[[email protected] ~]# useradd -u 1010 pure-ftp[[email protected] ~]# chown -R pure-ftp:pure-ftp /data/ftp[[email protected] ~]# pure-pw useradd ftp1 -u pure-ftp -d /data/ftp[[email protected] ~]# pure-pw mkdb 生成用户数据库[[email protected] ~]# pure-pw list /userdel/usermod/passwd 查看用户
Extended
Vsftp use MySQL to store virtual users and verify http://www.aminglinux.com/bbs/thread-342-1-1.html
FTP Active and Passive mode http://www.aminglinux.com/bbs/thread-961-1-1.html
2018-10-09