如何在LINUX(UBUNTU)实现FTP服务器多用户多权限

这篇具有很好参考价值的文章主要介绍了如何在LINUX(UBUNTU)实现FTP服务器多用户多权限。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

要求

实现两个用户,使得一个student可以上传,下载文件

另一个teacher可以上传,下载,删除文件

首先现在Ubuntu上安装ftp(以下使用vsftp演示)

//1.安装vsftpd
sudo apt-get install vsftpd
​
//2.检验是否按照成功
vsftpd -v
or
service vsftpd status
​
//3.修改vaftpd配置文件
/*
找到listen=YES
listen_ipv6=NO
将YES改为NO,将NO改为YES(因为我们一般使用ipv4)
*/
​
//4.添加用户组,将我们所需要的用户全部放到同一个组中进行
sudo groupadd ftpuser
​
//接下来我们有两种方法创建用户
1.使用adduesr + 用户名直接创建,此方法的好处就是实现了人机交互,较为方便
2.使用adduser + 用户名创建,之后再为其修改密码,修改参数即可
​
我们采用第二中方法
//5.创建用户
//5.1首先,再根目录下创建一个guest目录
mkdir /home/guest/(用于存放用户)
​
//添加teacher用户到用户组ftpuser中
sudo useradd -g ftpuser student
​
//为teacher设置密码
passwd teacher
​
//修改shell和权限
vim /etc/passwd
找到对应用户
将其末尾修改为:/bin/bash
//更改文件所有者的权限
chown -v -R teacher:ftpuser /home/guest
chmod -v -R 700 /home/guest
​
//重启服务
service vsftpd restart
​
//再linux终端输入ftp localhost即可访问fpt服务器
​
//同样的,使用类似的方法可以创建teacher用户

为了使student用户没有删除的权力,需要做以下更改

//首先新建一个文件夹
mkdir -p /etc/vsftpd_user_conf
​
//然后在该文件夹中创建一个文件并写入cmds_denied=DELE即可
vim ./你想要禁用的用户名
//此处为student
vim student
​
//重新打开配置文件
vim /etc/vsftpd.conf
//写入
user_config_dir=/etc/vsftpd_user_conf
​
//重启ftp服务即可

ftp服务器配置文件如下文章来源地址https://www.toymoban.com/news/detail-811192.html

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=NO
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=NO
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
​
#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES
#
allow_writeable_chroot=YES
​
​
#jingzhiguest(student)shanchu wej 
user_config_dir=/etc/vsftpd_user_conf


到了这里,关于如何在LINUX(UBUNTU)实现FTP服务器多用户多权限的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • ubuntu服务器配置ftp服务

    目录  一、安装vsftpd 二、配置vsftpd 三、设置安全组 四、客户端测试 SFTP服务的配置看主页的下一篇博客:ubuntu云服务器配置SFTP服务-CSDN博客 需求:配置ftp服务用于在windows电脑上直接浏览、下载、上传ubuntu服务器上的文件,用于文件共享,方便实用 效果:用户打开windows资源

    2024年02月13日
    浏览(45)
  • Linux系统编程,使用C语言实现简单的FTP(服务器/客户端)

    前言 跟着上官社长 陈哥花了一个月的时间终于把Linux系统编程学的差不多了,这一个月真的是头疼啊,各种bug,调的真心心累,不过好在问题都解决掉了,在此也感谢一下答疑老师,给我提供了很多的思路,本文章是对前段时间学习Linux,做一个小小的总结,才疏学浅,只学

    2024年02月12日
    浏览(63)
  • ftp用指定的用户名和密码无法登录到该ftp服务器解决方法

    这样一般是用设置ftp的登录账号和密码没有设置好的原因。 我们需要在新建好的ftp服务器里面选择这个 在进入这个弹窗后我们点击这个看有什么问题不 这样属于没有什么问题,如果授权那栏出现错误,一般是文件权限的问题或者是账号没填对,我们只需要填对指定账号和将

    2024年02月11日
    浏览(46)
  • Linux搭建 FTP服务器

    vsftpd 是 very secure ftp daemon 的缩写,它是 Linux 上使用最受欢迎、使用最广泛的 FTP 服务器之一,它具有安全,速度快,稳定的特点,很多重要的 FTP 站点比如 ftp.gnu.org、ftp.freebsd.org 都是使用 vsftpd 作为服务器的。 工作模式 服务器使用两个端口和客户端通信,一个是命令端口,

    2024年02月05日
    浏览(54)
  • 【Linux】FTP文件服务器

    FTP (File transfer protocol) 是TCP/IP 协议组中的协议之一。他最主要的功能是在服务器与客户端之间进行文件的传输。FTP就是实现两台计算机之间的拷贝,从远程计算机拷贝文件至自己的计算机上,称之为“下载 (download)”文件。将文件从自己计算机中拷贝至远程计算机上,则称

    2024年02月10日
    浏览(50)
  • Linux下搭建FTP服务器

    FTP协议:文件传输协议(File Transfer Protocol) 协议定义了一个在远程计算机系统和本地计算机系统之间传输文件的一个标准 FTP运行在OSI模型的应用层,并利用传输协议TCP在不同的主机之间提供可靠的数据传输 FTP 在文件传输中还支持断点续传功能,可以大幅度减少CPU网络带宽

    2024年02月02日
    浏览(47)
  • FTP服务器的搭建(Linux)

    摘要: FTP(File Transfer Protocol)即文件传输协议,是一种基于TCP的协议,采用客户/服务器模式。通过FTP协议,用户可以在FTP服务器中进行文件的上传或下载等操作。虽然现在通过HTTP协议下载的站点有很多,但是由于FTP协议可以很好地控制用户数量和宽带的分配,快速方便地上

    2024年02月08日
    浏览(42)
  • 如何修改ftp服务器密码

    其实FTP服务就相当于共享文件,你要进入FTP服务器首先要知道提供FTP这台电脑的IP或者域名。FTP服务器是可以设置访问的用户名和密码的,当然也可以设置匿名访问(设置了匿名访问,用户就不需要输用户名和密码了) IIS7服务器管理工具可以批量管理、定时上传下载、同步操作

    2024年02月08日
    浏览(89)
  • Ubuntu与Windows通讯传输文件(FTP服务器版)(没用的方法,无法施行)

    本文介绍再Windows主机上建立FTP服务器,并且在Ubuntu虚拟机上面访问Windows上FTP服务器的方法   只要按照上图配置就可以了 第二部:打开IIS管理控制台  右击网站,新建FTP站点。需要注意的一点是在填写IP地址的时候,只需要填写Windows本机的IP地址就可以了,不需要管虚拟机的

    2024年02月04日
    浏览(43)
  • FTP服务器移植到Linux开发板

    提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档 提示:这里可以添加本文要记录的大概内容: 将Linux开发板作为一个小型的 FTP 服务器,这样就可以通过 FileZilla 软件直接在开发板和 windows 之间通过网络进行文件互传。在开发板上搭建 FTP 服务器很简单

    2024年02月14日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包