解决vsftpd 500 OOPS: cannot locate user entry:nobody报错

问题描述

本问题基于vsftpd 3.0.5

使用ftp客户端连接vsftpd服务端报错日志及截图如下:

oldsix@OLDSIX:~/work$ ftp root@192.168.69.1
Connected to 192.168.69.1.
500 OOPS: cannot locate user entry:nobody
ftp>

问题截图:


---

原因分析:
 

1、根据官方源码中的资料解释:

(1)vsftpd3.0.5/INSTALL

vsftpd needs the user "nobody" in the default configuration. Add this
user in case it does not already exist. e.g.:
[root@localhost root]# useradd nobody
useradd: user nobody exists
翻译过来就是:
vsftpd在默认配置中需要用户“nobody”。添加此用户,以防它不存在。例如:
[root@localhostroot]#useradd nobody

(2)vsftpd3.0.5/FAQ

Q) Help! I'm getting the error message "str_getpwnam".

A) The most likely cause of this is that the user that is configured as the

'nopriv_user' setting (often 'nobody') does not exist on your system. vsftpd

needs this user to run bits of itself with no privilege.

(3)vsftpd3.0.5/vsftpd.conf

# 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

2、通过跟踪源码发现


vsftpd3.0.5/tunables.c
  install_str_setting("nobody", &tunable_nopriv_user);

通过跟踪发现

该参数默认为nobody,并存储在全局变量tunable_nopriv_user中,跟踪代码发现

nopriv_user为tunable_nopriv_user配置选项,和vsftpd.conf描述一致。---

 解决方案:


根据问题原因可给出以下三个解决方案:

1、vsftpd服务器所在系统增加nobody用户

2、修改/etc/vsftpd.conf配置

nopriv_user=系统中已经存在的用户(cat /etc/passwd )。

3、修改源码(不建议)

vsftpd3.0.5/tunables.c文件中的
  install_str_setting("nobody", &tunable_nopriv_user);将nobody

替换为系统中存在的用户。

修改后编译替换原来的vsftpd服务器即可

ps:可通过cat /etc/passwd 查看已存在用户。

当你遇到 "500 OOPS: vsftpd: cannot locate user specified in 'guest_username': ftpuser" 这个错误,这是在使用vsftpd (Very Secure FTP Server) 配置文件中设置匿名访问(guest_username)时发生的。这个错误意味着 vsftpd 没有找到你在配置文件中指定的作为匿名用户的那个用户名(通常是 "ftpuser")。 解决这个问题的步骤通常包括以下几个方面: 1. **检查配置**:确保在`vsftpd.conf`文件中,`anonymous_enable` 设置为 `yes` 并且有一个 `guest_username` 行,指定了一个存在的用户名,例如: ```bash anonymous_enable=YES guest_username=ftpuser ``` 确保 "ftpuser" 用户已存在于系统中,并且有足够的权限允许匿名访问。 2. **创建用户**:如果尚未创建名为 "ftpuser" 的用户,需要使用 `adduser` 命令来添加: ```bash sudo adduser ftpuser ``` 可能还需要设置适当的权限,比如给该用户读取目录的权限。 3. **权限设置**:检查 `ftpuser` 是否有正确的文件夹访问权限,可以使用 `chown` 或 `chmod` 命令来调整。 4. **重启服务**:完成上述操作后,别忘了重启 vsftpd 服务使其应用更改: ```bash sudo systemctl restart vsftpd ``` 5. **检查日志**:查看 `/var/log/vsftpd.log` 文件,找出更多关于错误的具体信息,以便进一步排查。 如果你按照这些步骤仍然无法解决问题,可能是其他配置冲突或者权限问题,这时候查看官方文档或者寻求更详细的帮助是必要的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值