Chr*_*ugh 28 webserver vsftpd 12.04
到目前为止,我一直无法将 FTP 用户关押在他们的网站目录中。是否有解决方案既可以修复此错误,又可以将用户关在他们的目录中?
我更改的 vsFTPd 设置:
listen_port=9000
Set: anonymous_enable=NO
Uncomment: local_enable=YES
Uncomment: write_enable=YES
Uncomment: local_umask=022
Set: connect_from_port_20=NO
Uncomment: idle_session_timeout=600
Uncomment: data_connection_timeout=120
Comment out: #ftpd_banner=Welcome to blah FTP service. [should be on line 104]
Added: banner_file=/etc/issue.net
Uncomment: chroot_local_user=YES
Uncomment: chroot_local_user=YES
Uncomment: chroot_list_enable=YES
Uncomment : chroot_list_file=/etc/vsftpd.chroot_list
Run Code Online (Sandbox Code Playgroud)
在文件末尾,我添加了:
# Show hidden files and the "." and ".." folders.
# Useful to not write over hidden files:
force_dot_files=YES
# Hide the info about the owner (user and group) of the files.
hide_ids=YES
# Connection limit for each IP address:
max_per_ip=10
# Maximum number of clients:
max_clients=5
# FTP Passive Settings
pasv_enable=YES
#If your listen_port is 9000 set this range to 7500 and 8500
pasv_min_port=[port range min]
pasv_max_port=[port range max]
Run Code Online (Sandbox Code Playgroud)
有问题的用户mybloguser
被监禁在她/他的网站目录下,/srv/www/myblog
并且该用户不是该nano /etc/vsftpd.chroot_list
文件的一部分。用户的主目录也是/srv/www/myblog
过去用来工作的。
我尝试了allow_writeable_chroot=YES
无效的解决方案,实际上完全破坏了 vsFTPd。
我试过了:
我们如何才能修复此错误并将用户囚禁在其主目录中?
小智 27
对于 VSFTPD 3,
/etc/vsftpd.conf
并添加这个:
allow_writeable_chroot=YES
Run Code Online (Sandbox Code Playgroud)
如果它还不存在,只需添加它。
重启 vsftpd 服务:
service vsftpd restart
Run Code Online (Sandbox Code Playgroud)它应该工作。
小智 17
这个问题的真正解决方案:用户的主文件夹不应该是可写的,只能是可读的。
所以,如果用户站点在文件夹中cat/example.com/http/
,文件夹cat
必须有chmod 555
,一切都会好的。
Chr*_*ugh 13
在进一步查看这篇文章后,在评论中发布了一个解决我问题的软件包。您可以通过我的名字或“标记”文档进行搜索:http : //www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/。这是我如何进一步解决此问题的详细信息。
用户仍然被监禁在他们的家庭目录中!!!
# ------------------------------------------------------------------------------
# SETUP FTP USERS --------------------------------------------------------------
# ------------------------------------------------------------------------------
# create the ftp users and lock them to the website directories
useradd -d /srv/www/[website/appname] -m [ftp user name]
# set the ftp account passwords
passwd [ftp user name]
# add the ftp users to the www-data user/group
adduser [ftp user name] www-data
# BUG FIX: 500 OOPS: vsftpd: refusing to run with writable root inside chroot()
sudo add-apt-repository ppa:thefrontiergroup/vsftpd
sudo apt-get update
sudo apt-get install vsftpd
# Edit the vsftpd.conf and append this setting to the end of the file to keep users' jailed!
nano /etc/vsftpd.conf
# add all of the text between the starting [[ and ending ]]
# [[
# Keep non-chroot listed users jailed
allow_writeable_chroot=YES
# ]]
# restart the service for changes to take effect
sudo service vsftpd restart
#test ftp via secondary terminal window:
ftp [ftp user name]@[server ipaddress] [ftp port]
Run Code Online (Sandbox Code Playgroud)
根据之前的回答“这个问题的真正解决方案:用户的主文件夹不应该是可写的,只能是只读的。”。一般的想法是对的,但有一个错误的认识。
下面我将尝试举一个简单的例子:
首先,我们需要构建用户目录的拓扑:
/home (ro) |-someuser (rw,700) |-ftp_upload (ro,555) - ch_rooting 在这里,需要 vsftpd 只读:( |-temp (rw,755) |-in_box (rw,755) |-out_box (rw,755)
vsftpd.conf 切:
# 启用 chroot chroot_local_user=是 # chroot 除在 chroot_list 中监听的所有用户 chroot_list_enable=是 # 异常列表。理想情况下,它应该是空白的 ;) chroot_list_file=/etc/vsftpd/chroot_list # 将ftp根目录映射到特定目录 local_root=/home/someuser/ftp
此配置适用于单用户配置。对于多用户,应额外使用“user_config_dir”指令。
**更新 20/09
------**
这是棘手的解决方法,不是最好的使用方法,但是.... 如果您需要可写的 ftp 根文件夹,只需在启动前和启动后命令中插入权限更改命令。
预启动 - 将服务器要求的权限更改为只读(:
启动服务器
启动后 - 更改读写权限或您需要的权限。
归档时间: |
|
查看次数: |
166306 次 |
最近记录: |