前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ubuntu vsftpd 530 Login incorrect

Ubuntu vsftpd 530 Login incorrect

作者头像
上山打老虎了
发布2022-06-15 08:45:40
1K0
发布2022-06-15 08:45:40
举报
文章被收录于专栏:Article

最近有个需求要开放 FTP 服务给别人下载日志,因此装上了 vsftpd。但是在登录过程中提示 530 Login incorrect。查阅了一些资料记录一下解决方法。

这里采用系统本地用户控制登录权限,因此大部分的教程都会让你添加本地用户:

代码语言:javascript
复制
useradd -d /home/ftp/testUser testUser

添加后的结果, 使用 cat /etc/passwd

代码语言:javascript
复制
testUser:x:1000:1000::/home/ftp/testUser:

如果使用 adduser testUser 添加一个用户

代码语言:javascript
复制
testUser:x:1000:1000:,,,:/home/testUser:/bin/bash

末尾多了/bin/bash 的配置内容,而这个决定了 vsftpd 的用户能否 ftp 登录。

直接编辑 vim /etc/passwd加上

代码语言:javascript
复制
/usr/sbin/nologin
# 或者
/bin/false

即可,它们的含义都是不让这个用户拥有 ssh登录系统的权限,关于这两个的区别:

When /sbin/nologin is set as the shell, if user with that shell logs in, they’ll get a polite message saying ‘This account is currently not available.’ This message can be changed with the file /etc/nologin.txt. /bin/false is just a binary that immediately exits, returning false, when it’s called, so when someone who has false as shell logs in, they’re immediately logged out when false exits. Setting the shell to /bin/true has the same effect of not allowing someone to log in but false is probably used as a convention over true since it’s much better at conveying the concept that person doesn’t have a shell. Looking at nologin‘s man page, it says it was created in 4.4 BSD (early 1990s) so it came long after false was created. The use of false as a shell is probably just a convention carried over from the early days of UNIX. nologin is the more user-friendly option, with a customizable message given to the user trying to log in, so you would theoretically want to use that; but both nologin and false will have the same end result of someone not having a shell and not being able to ssh in. https://unix.stackexchange.com/questions/10852/whats-the-difference-between-sbin-nologin-and-bin-false#:~:text=%2Fbin%2Ffalse%20is%20just%20a,logged%20out%20when%20false%20exits.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020年12月05日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档