2018-05-10 Linux Learning

Source: Internet
Author: User

14.4 Exportfs Command

Common options
-A all mount or uninstall all
-R Re-mount
-U Uninstalls a directory
-V Show shared directory

以下操作在服务端上    vim /etc/exports   //增加    /tmp/,sync,no_root_squash)    exportfs -arv      //不用重启nfs服务,配置文件就会生效以下操作在客户端    mkdir /aminglinux    mount -t nfs -onolock /aminglinux    touch /aminglinux/test.txt    ls -l !$    -oremount,nfsvers=3

NFS server can not be restarted at will, need to uninstall first

Operation Process

服务器端[[email protected] ~]# vim /etc/exports/tmp/,sync,no_root_squash)[[email protected] ~]# exportfs -arvexporting客户端[[email protected] ~]# mount -t nfs -onolock /mnt[[email protected] ~]# touch /mnt/1122.txt[[email protected] ~]# ls -l /mnt/1122.txt -rw-r--r--. 1 root root 0 4月  10 02:58 /mnt/1122.txt

14.5 NFS Client Issues

The client file belongs to the main genus group nobody

NFS 4版本会有该问题客户端挂载共享目录后,不管是root用户还是普通用户,创建新文件时属主、属组为nobody客户端挂载时加上 -o nfsvers=3客户端和服务端都需要vim /etc/idmapd.conf     //把“#Domain = local.domain.edu” 改为 “Domain = xxx.com” (这里的xxx.com,随意定义吧),然后再重启rpcidmapd服务

Operation Process

[Email protected] ~]# mount-t nfs-onfsvers=3
[Email protected] ~]# mount-t nfs-oremount,nfsvers=3

15.1 FTP Introduction

FTP是File Transfer Protocol(文件传输协议,简称文传协议)的英文简称,用于在Internet上控制文件的双向传输。FTP的主要作用就是让用户连接一个远程计算机(这些计算机上运行着FTP服务器程序),并查看远程计算机中的文件,然后把文件从远程计算机复制到本地计算机,或把本地计算机的文件传送到远程计算机。小公司用的多,大企业不用FTP,因为不安全

15.2 using VSFTPD to build FTP service (top)

Bring your own vsftpd on CentOS
Yum Install-y vsftpd
Useradd-s/sbin/nologin virftp
Vim/etc/vsftpd/vsftpd_login//content as follows, odd behavior username, even behavior password, multiple users write multiple lines
chmod 600/etc/vsftpd/vsftpd_login
Db_load-t-T Hash-f/etc/vsftpd/vsftpd_login/etc/vsftpd/vsftpd_login.db

Vim TestUser1//Add the following:

Chown-r virftp:virftp/home/virftp
VIM/ETC/PAM.D/VSFTPD//At the front Plus
Auth sufficient/lib64/security/pam_userdb.so Db=/etc/vsftpd/vsftpd_login
Account Sufficient/lib64/security/pam_userdb.so Db=/etc/vsftpd/vsftpd_login

Change Anonymous_enable=yes to Anonymous_enable=no
Change #anon_upload_enable=yes to Anon_upload_enable=no
Change #anon_mkdir_write_enable=yes to Anon_mkdir_write_enable=no
Add the following:
Systemctl start vsftpd//Start VSFTPD Service

Operation Process

[[email protected] ~]# yum install-y vsftpd[[email protected] ~]# useradd-s/sbin/nologin virftp[[email  protected] ~]# vim/etc/vsftpd/vsftpd_logintestuser1aminglinuxuser1aming[[email protected] ~]# chmod 600/ Etc/vsftpd/vsftpd_login[[email protected] ~]# db_load-t-t hash-f/etc/vsftpd/vsftpd_login/etc/vsftpd/vsftpd_ Login.db[[email protected] ~]# ls-l/etc/vsftpd/total dosage 36-rw-------. 1 root root 125 August 3 ftpusers-rw-------. 1 root root 361 August 3 USER_LIST-RW-------. 1 root root 5030 August 3 vsftpd.conf-rwxr--r--. 1 root root 338 August 3 vsftpd_conf_migrate.sh-rw-------. 1 root root 33 April 05:23 Vsftpd_login-rw-r--r--. 1 root root 12288 April 05:25 vsftpd_login.db[[email protected] ~]# mkdir/etc/vsftpd/vsftpd_user_conf[[email  Protected] ~]# cd/etc/vsftpd/vsftpd_user_conf/[[email protected] vsftpd_user_conf]# vim testuser1local_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[[email protected] vsftpd_user_conf]# mkdir/home/virftp/testuser1[[email protected] vsftpd_user_conf ]# touch/home/virftp/testuser1/aming.txt[[email protected] vsftpd_user_conf]# chown-r virftp:virftp/home/ Virftp[[email protected] vsftpd_user_conf]# vim/etc/pam.d/vsftpd Add the following two lines at the start location #%pam-1.0auth sufficient/lib64/ security/pam_userdb.so Db=/etc/vsftpd/vsftpd_loginaccount sufficient/lib64/security/pam_userdb.so db=/etc/vsftpd/ Vsftpd_login[[email protected] vsftpd_user_conf]# vim/etc/vsftpd/vsftpd.conf change Anonymous_enable=yes to Anonymous_enable=no change #anon_upload_enable=yes to Anon_upload_enable=no change #anon_mkdir_write_enable=yes to Anon_mkdir_ Write_enable=no Add the following content chroot_local_user=yesguest_enable=yesguest_username=virftpvirtual_use_local_privs= Yesuser_config_dir=/etc/vsftpd/vsftpd_user_confallow_writeable_chroot=yes[[email protected] Vsftpd_user_ Conf]# systemctl start vsftpd[[email protected] vsftpd_user_conf]# PS aux |grep vsftpdroot 13671 0.0 0.0 53212        572? Ss 05:42 0:00/usr/sbin/vsftpd/etc/vsftpd/vsftpd.confroot 13674 0.0 0.0 112676 980 pts/0 r+ 05:44 0:0 0 grep--color=auto vsftpd[[email protected] vsftpd_user_conf]# netstat-lnptactive Internet connections (only      servers) Proto recv-q send-q Local address Foreign address State Pid/program name TCP 0             0* listen-tcp 0 0     * LISTEN 1/systemd TCP 0 0*      LISTEN 11434/rpc.mountd TCP 0 0* LISTEN 965/nginx:master p TCP 0 0* LISTEN 931/sshd TC      P 00* LISTEN 11421/rpc.statd TCP 0 0     * LISTEN 1243/master TCP 0 0*                   LISTEN 965/nginx:master p TCP 0 0* LISTEN-       TCP6 0 0::: 111:::* LISTEN 1/systemd TCP6                 0 0::: 20048:::* LISTEN 11434/rpc.mountd tcp6 0 0::: 33620                    :::* listen-tcp6 0 0::: £ º::* LISTEN 13671/vsftpd tcp6 0 0::: +:::* LIST         EN 931/sshd tcp6 0 0:: 1:25:::* LISTEN 1243/master      TCP6 00::: 2049:::* listen-tcp6 0 0::: 33702 :::* LISTEN 11421/rpc.statd

15.3 using VSFTPD to build FTP service (next)

Test FTP

yum install -y lftplftp [email protected]执行命令ls,看是否正常输出若不正常查看日志/var/log/messages和/var/log/securewindows下安装filezilla客户端软件,进行测试

Operation Process

[[email protected] ~]# lftp [email protected]口令: lftp [email protected]:~> ls      -rw-r--r--    1 1004     1004            0 Apr 09 21:32 aming.txt

2018-05-10 Linux Learning

Related Article

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.