Linux - FTP and NFS Basic Configuration

IP Hostname Remark
192.168.88.12 ftptest Turn off the firewall

Part blog (FTP description and configuration): HTTPS: //blog.csdn.net/qq_20027745/article/details/104760514
4.FTP black list configuration
user_list: as the user whitelist or blacklist, or invalid list. Completely determined by userlist_enable and userlist_deny these two parameters.
ftpusers: only user blacklist, without any parameter limits

①FTP blacklist file / etc / vsftpd / ftpusers

[root@ftptest ~]# useradd test1    //创建用户
[root@ftptest ~]# passwd test1		//设置密码
[root@ftptest ~]# vi /etc/vsftpd/ftpusers  
test1					//添加到文件末尾,不要有多余空格

Use File Zilla test access this FTP, login attempt will fail to test1
Here Insert Picture Description

② / etc / vsftpd / user_list file
[vi /etc/vsftpd/vsfptd.conf // modify vsftpd service configuration]

userlist_enable=YES   userlist_deny=YES  黑名单,拒绝文件中的用户FTP访问
 
userlist_enable=YES   userlist_deny=NO   白名单,拒绝除文件中的用户外的用户FTP访问
 
userlist_enable=NO   userlist_deny=YES/NO  无效名单,表示没有对任何用户限制FTP访问

In short, to get user_list effective, userlist_enable = YES

When configured as userlist_enable = YES userlist_deny = YES

[root@ftptest ~]# vi /etc/vsftpd/vsftpd.conf			
userlist_deny=YES				//修改为YES
userlist_enable=YES				//修改为YES		
[root@ftptest ~]# useradd test2
[root@ftptest ~]# passwd test2
[root@ftptest ~]# vi /etc/vsftpd/user_list 
test2			//添加到文件末尾,不要有多余空格
[root@ftptest ~]# service vsftpd restart

Access this FTP, test2 attempt to login fails, then user_list blacklist.
Here Insert Picture Description

When configured as userlist_enable = YES userlist_deny = NO

[root@ftptest ~]# vi /etc/vsftpd/vsftpd.conf			
userlist_deny=NO				//修改为YES
userlist_enable=YES				//修改为YES		
		##user_list文件保持不变
[root@ftptest ~]# service vsftpd restart

Access this FTP, test2 try to log in successfully, this time user_list white list.
Here Insert Picture Description

NFS Basic Configuration

IP Hostname Remark
192.168.88.12 NFSSERVER Server
192.168.88.13 nfsclient Client

1. were installed in the server and client nfs-utils, rpcbind and start
// turn off the firewall and selinux in advance, so as not to affect the results.

#  yum install -y nfs-utils rpcbind
#  systemctl start nfs
#  systemctl enable nfs
#  systemctl start rpcbind
#  systemctl enable rpcbind

2. Create a shared directory server

[root@nfsserver ~]# mkdir /data
[root@nfsserver ~]# mkdir /data/public
[root@nfsserver ~]# mkdir /data/test
[root@nfsserver ~]# chown -R nfsnobody:nfsnobody /data
[root@nfsserver ~]# chmod -R 755 /data
[root@nfsserver ~]# ll /data/
total 0
drwxr-xr-x. 2 nfsnobody nfsnobody 6 Mar 11 00:52 linux
drwxr-xr-x. 2 nfsnobody nfsnobody 6 Mar 11 00:52 public
drwxr-xr-x. 2 nfsnobody nfsnobody 6 Mar 11 00:52 test

3. Configure nfs server configuration file

[root@nfsserver ~]# vi /etc/exports	//内容如下
/tmp *(rw,no_root_squash)
/data/public    192.168.88.0/24(rw)
/data/test      192.168.88.13(rw)

May be added in parentheses behind options:
RW: write
ro: read-only
sync: synchronization pattern, while writing data to the hard disk and memory, slower but secure
async: asynchronous mode, the priority data stored in the memory, and then written to disk, but faster unsafe
root_squash: when the NFS client access to the root administrator privileges and general user as
no_root_squash: when the NFS client access to the root administrator, the highest authority
all_squash: whether NFS client account what access permissions are ordinary users
anonuid / anongid: all_squash and root_squash and used together, for the specified user using the NFS uid is defined and GID, required the presence of their respective native uid and gid.

4. Restart nfs service

[root@nfsserver ~]# systemctl restart nfs
				//systemctl reload nfs  也可直接使用重新加载nfs配置

5. In the client view shared directory listing

[root@nfsclient ~]# showmount -e 192.168.88.12
Export list for 192.168.88.12:
/tmp         *
/data/public 192.168.88.0/24
/data/test   192.168.88.13

6. Client to mount and read and write permissions test

[root@nfsclient ~]# mount -t nfs 192.168.88.12:/data/public /opt/
[root@nfsclient ~]# df -hT
Filesystem                 Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root    xfs        50G  3.4G   47G   7% /
devtmpfs                   devtmpfs  2.9G     0  2.9G   0% /dev
tmpfs                      tmpfs     2.9G     0  2.9G   0% /dev/shm
tmpfs                      tmpfs     2.9G  8.6M  2.9G   1% /run
tmpfs                      tmpfs     2.9G     0  2.9G   0% /sys/fs/cgroup
/dev/mapper/centos-home    xfs        46G   33M   46G   1% /home
/dev/sda1                  xfs       497M  125M  373M  26% /boot
tmpfs                      tmpfs     586M     0  586M   0% /run/user/0
192.168.88.12:/data/public nfs4       50G  1.1G   49G   3% /opt
[root@nfsclient ~]# touch  /opt/test.txt
[root@nfsclient ~]# echo '666' > /opt/test.txt 
[root@nfsclient ~]# cat /opt/test.txt 
666

7. The client is configured to automatically mount (Both techniques)

[root@nfsclient ~]# vi /etc/rc.local 
mount -t nfs 192.168.88.12:/data/public /opt		//添加到文件末尾

[root@nfsclient ~]# vi /etc/fstab 
192.168.88.12:/data/public    /opt    nfs    defaults    0    0  //添加到文件末尾

Released six original articles · won praise 0 · Views 140

Guess you like

Origin blog.csdn.net/qq_20027745/article/details/104782291