通过PHP添加FTP用户的安全方法是什么?

发布于 2025-01-28 12:53:21 字数 316 浏览 3 评论 0原文

网站上有一个表单,其中包含用于管理员的“ FTP用户名”和“ FTP密码”。

如何通过PHP安全地添加FTP用户?因为当前我们正在通过SSH -root-用户连接到服务器,这是最糟糕的解决方案。因此,对于辅助解决方案,我们将其添加到Sudoers中,仅启用了几个命令。

echo "testuser ALL=(ALL) NOPASSWD:/bin/mkdir,/bin/rmdir" > /etc/sudoers.d/testuser

但是userAdd命令呢?如果我们也允许普通用户,那也不是安全的吗?

There is a form on the website with "FTP username" and "FTP password" for administrators.

How to safely add the FTP user by PHP? Because currently we are connecting to the server via ssh - root - user, that's the worst solution. So for secondary solution we are added a normal user to the sudoers and enabled only a few commands for the user.

echo "testuser ALL=(ALL) NOPASSWD:/bin/mkdir,/bin/rmdir" > /etc/sudoers.d/testuser

But what about the useradd command? if we allow that too for the normal user, it will not be safe too isn't it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文