linux中ftp怎么搭建

1 、为了保证系统安全,通常会创建FTP用户。
该用户无法登录,只能访问其主目录中的文件。
useradd-d/var/ftp/test-gftp-s/sbin/nologinftpuser Among them, the command -d specifies the user's home directory, -g specifies the user group, -s/sbin/nologin prevents users from logging in, and finally ftpuser is the name of the new user.然后设置密码:passwdfptuser2 设置登录用户列表并将新用户添加到FTP用户列表。
配置用户列表的方法:打开配置文件,找到以下两行,去掉注释。
chroot_list_enable=YES#(defaultfollows)chroot_list_file=/etc/vsftpd/chroot_list Defines a list of users, and only users from this list can login. 3 . 创建文件 /etc/vsftpd/chroot_list 并将可用用户名 ftpuser 添加到其中。
然后重新启动FTP服务。
Explanation of operation: -d/var/ftp/test ----------------------------------The remote computer accesses the root directory of this ftp server, and the list of files corresponds to this directory. useradd/passwd--------------------------------Local username and password /etc/vsftpd/chroot_list--------------------------------Use local username XX as ftp username

Linux FTP Server如何加密传输

在Linux上实现FTP传输加密主要有两种方法:FTPS(基于SSL/TLS的FTP)和SFTP(基于SSH的文件传输协议)。
具体设置步骤如下: 1 . 使用FTPS(FTPSecure)进行加密传输。
FTPS 通过在传统 FTP 协议之上叠加 SSL/TLS 加密层来确保数据安全。
您必须使用支持 SSL/TLS 的 FTP 服务器软件(例如 vsftpd 或 ProFTPD)。
以 vsftpd 为例: 安装 vsftpd 和 OpenSSL sudoapt-getupdatesudoapt-getinstallvsftpdopenssl 生成 SSL 证书和私钥 运行以下命令生成自签名证书(有效期 3 6 5 天,密钥长度 2 04 8 位): sudoopensslreq-x5 09 -nodes-days3 6 5 -newkeyrsa:2 04 8 -keyout/etc/ssl/private/vsftpd.pem-out/etc/ssl/private/vsftpd.pem 按要求输入国家、组织等信息后,证书和私钥将保存在/etc/ssl/private/vsftpd.pem中。
配置vsftpd启用SSL/TLS 编辑配置文件:sudonano/etc/vsftpd.conf 编辑或添加以下参数: ssl_enable=YES#启用SSLallow_anon_ssl=NO#禁止匿名用户使用SSLforce_local_data_ss l=YES#强制使用本地数据传输 SSLforce_local_logins_ssl=YES#强制使用SSL登录 processssl_tlsv1 =YES#Enable TLSv1 ssl_sslv2 =NO#Disable SSLv2 (insecure) ssl_ss lv3 =NO#Disable SSLv3 (insecure) rsa_cert_file=/etc/ssl/private/vsftpd.pem#Certificate path rsa_private_key_file=/etc/ssl/private/vsftpd .pem# Restart the service after saving the private key path: sudosystemctlrestartvsftpd 2 . Use SFTP (SSHFileTransferProtocol) for encrypted transmission. SFTP 基于 SSH 协议,不需要额外的证书即可通过加密通道传输文件。
Take OpenSSH as an example: Install the OpenSSH server sudoapt-getupdatesudoapt-getinstallopenssh-server Configure the SFTP subsystem Edit the SSH configuration file: sudonano/etc/ssh/sshd_config Make sure the following line exists (if you don't find it, add it manually): Subsystemsftp/usr/lib/openssh/sftp-server If you need to limit users to using SFTP only, it can be replaced from: Subsystemsftpinternal-sftp and added user restriction configuration (example): MatchGroupsftpusers#Restrict users of sftpusers group ChrootDirectory/home#Restrict to /home directory ForceCommandinternal-sftp#Force use of SFTPAllowTcpForwardingno#Prohibit port forwarding Restart SSH service after saving: sudosystemctlrestartssh 3 . Key differences and tips selection FTPS Advantages: Compatible with传统FTP客户端,支持显式/隐式加密。
缺点:需要管理证书,并且防火墙可能需要打开其他端口(如 9 9 0)。
适用场景:需要兼容旧系统或者明确需要FTP协议的环境。
SFTP 优点:基于 SSH,无需额外证书,兼容防火墙(默认端口 2 2 )。
缺点:不兼容FTP协议,需要使用SFTP客户端。
适用场景:安全要求较高或者已经使用SSH的环境。
4 .验证配置测试FTPS 使用支持FTPS的客户端(如FileZilla),输入服务器地址、端口(默认2 1 )、用户名和密码并选择“explicit FTPoverTLS”连接。
SFTP测试使用SFTP协议通过命令行或客户端(如WinSCP)进行连接。
The default port is 2 2 . Through the above steps, you can achieve encrypted transmission of Linux FTP server and select FTPS or SFTP solution according to actual esigenze.

linux系统ftp共享文件怎么设置

Linux system is also a very common and widely used system. Moreover, ftp file share under Linux system is preferred by many people and is very practical indeed.那么如何在Linux系统中设置ftp文件共享呢? Add the ftp user in Linux and set the corresponding permissions.步骤如下绿色字体所示(只要机器上安装了ftp服务,就可以创建用户访问服务器上的任意目录,该目录只需按照以下步骤配置,然后重新启动ftp服务即可): 1 、环境:FTP为vsftp。
有限的用户名是一个测试。
受限路径是/home/ftp2 创建用户:在root用户下:useradd -d /home/ftptest //添加一个测试用户,并将测试用户的主目录设置为/home/ftppasswdtest //设置测试的密码 3 、更改相应的用户权限设置:(一般情况,如果只添加用户,这一步可以不用!一般情况下不需要配置)这一步。
usermod -s /sbin/nologintest //限制用户测试不能telnet,只能ftpusermod -s /bin/bashtest //将用户测试恢复到正常 usermod -d /testtest //更改用户测试主目录为 /test4 ,修改 /etc/vsftpd/vsftpd.conf 文件如下: onymous_enable=NO##Uncommentthistoallowlocaluserstologin.local_enable=YES##UncommentthistoenableanyformofFTPwrite command.write_enable=YES 最后,在文件末尾添加以下行: userlist_enable=YESuserlist_deny=NOuserlist_file=/etc/vsftpd。
/etc/vsftpd/vsftpd.conf 文件。
5 . Restrict users to only access /home/test and cannot access other paths.修改/etc/vsftpd/vsftpd.conf如下: chroot_list_enable=YES //限制访问自己的目录 #(defaultfollows)chroot_list_file=/etc/vsftpd/vsftpd.chroot_list。
Edit the /etc/vsftpd/vsftpd.chroot_list file to remove restricted users.添加用户,为每个用户名添加一行,如下: test/home/ftp 编辑文件 /etc/vsftpd/vsftpd.user_list,添加受限用户,为每个用户名添加一行,如下: test 完成配置文件的配置更改,不要忘记重新启动 vsFTPd 服务器 [root/inituxsir001 /et.restart。
After starting, test and log in using the local user test and its password.它起作用了。
如果此时无法进行写入操作或者登录时出现其他错误,请检查测试用户对应的/home/ftp文件夹,看看测试用户是否有对该文件夹的写入权限。
6 、如果需要允许用户修改密码,但没有通过telnet登录系统的权限:(一般情况下,如果只是添加用户,则不需要这一步!!一般情况下,配置ftp不需要这一步) usermod -s /usr/bin/passwdtest //之后会继续更改telnet界面,用户会进入该界面。
At this point, we can use the newly added user test to login to ftp. Above is a detailed introduction on how to set up ftp shared files in Linux system.如果您对本次信息泄露的安全性还不太了解,可以关注北灵安全网,了解更多文件共享的方法和方法。