在FTP中没有人拥有(99 99)由php函数引起? [英] Nobody owner (99 99) in FTP caused by php functions?

查看:146
本文介绍了在FTP中没有人拥有(99 99)由php函数引起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在服务器上创建文件和目录的脚本(Joomla)。问题是它在99 99(nobody)的所有者下创建它们,并且在没有服务器管理员的帮助下无法通过FTP删除或修改它们。



I认为是 move_uploaded_file php的功能。



WHM或服务器是否存在此问题的任何解决方案管理员?我可以在ftp中修改默认的所有者吗?

解决方案

HTTP服务器由名为nobody的用户运行,而你的FTP用户是另一个。当上传发生时,HTTP服务器在其用户名下创建文件,并且您的FTP用户无权写入(或删除)这些文件。



最简单的方法修复这个问题(但并不真正安全)是将两个用户添加到同一个组中,并更改文件权限以允许同一组的用户读取/写入这些文件。



你的管理员应该照顾它,但是你必须调用chmod()来更改你上传文件的权限。



更好地解释它:



linux / unix文件权限由用户(u),组(g)和其他人(o)的权限组成。
我只会在这里讨论3种类型的文件权限,它们是读(r),写(w)和执行(x)。所以,你最终会有这样的事情:

  -rw-rw --- x 1 jweyrich staff 12288 Oct 24 00: 22 avatar.png 




  • 第一个rw-权限(读/写入)拥有文件(jweyrich)的用户。

  • 第二个rw-是拥有文件(员工)的GROUP的权限(读/写)。
  • >
  • 最后的-x是OTHERS用户的权限(执行)。



您的PHP脚本以nobody用户身份运行(也就是说,nobody组),因此您从PHP创建的每个文件都将由nobody用户(及其组)拥有。用户可以是一个或多个组的一部分。

为了解决权限问题,您的FTP用户和nobody必须位于 common 组中,让我们假设admin将您的用户在无人中。
一旦它们在同一组中,您的PHP脚本必须为nobody组成员提供rw(读/写)权限。要做到这一点:

  chmod(path_to_your_file,0770); 

0770相当于u + rwx,g + rwx,o-rwx,其中I在这里解释:
$ b


  • u + rwx =用户(所有者,即nobody)给予读/写/执行权限 li>
  • u + rwx =对于group(也是nobody),赋予读/写/执行许可权
  • o-rxw =读取/写入/执行权限



之后,您的FTP用户现在成为nobody组的成员,读/写访问上传的文件,因此也可以删除文件。它看起来像这样:

  -rwxrwx --- 1 nobody nobody 12288 Oct 24 00:22 avatar.png 

这不是unix文件权限的理想介绍,但我希望这有助于。


I have a script (Joomla) that creates files and directories on the server. The problem is that it creates them under owner 99 99 (nobody) and after I can't delete or modify them by FTP without the help of the server admin.

I think that is move_uploaded_file function of php.

Is there any solution of this problem by the WHM or by the server admin? Can I modify the default owner in ftp?

解决方案

What happens is the HTTP server is ran by a user called "nobody", and your FTP user is another one. When the upload occurs, the HTTP server creates the file under its username, and your FTP user has no permission to write (or delete) these files.

The easiest way to fix this (but not really secure) is to add both users in a same group, and change the file permissions to allow users of the same group to read/write on these files.

Your admin should take care of it, but you'll have to call chmod() to change the permissions of your uploaded files.

Explaining it better:

The linux/unix file permissions are composed by permissions of user (u), group (g) and others (o). I'll only cover 3 types of file permisions here, which are read (r), write (w) and execute (x). So, you end up having something like this:

-rw-rw---x   1 jweyrich  staff  12288 Oct 24 00:22 avatar.png

  • The first rw- is the permission (read/write) of the USER that owns the file (jweyrich).
  • The second rw- is the permission (read/write) of the GROUP that owns the file (staff).
  • The --x at the end are the permissions (execute) of the OTHERS users..

Your PHP scripts run as "nobody" user (and by, let's say, "nobody" group), so every file you create from your PHP will be owned by the "nobody" user (and his group). A user can be part of one or more groups.

To solve the permission problem, your FTP user and the "nobody" must be in a common group, let's say the admin put your user in the "nobody". Once they're in the same group, your PHP script has to give "rw" (read/write) permissions to the "nobody" group members. To do so:

chmod("path_to_your_file", 0770);

The 0770 is equivalent to "u+rwx,g+rwx,o-rwx" , which I explain here:

  • u+rwx = for user (owner, which is "nobody"), give read/write/execute permissions
  • u+rwx = for group (which is also "nobody"), give read/write/execute permissions
  • o-rxw = for others, remove the read/write/execute permissions

After that, your FTP user, which is now part of the "nobody" group, will have read//write access to the uploaded files, and thus can also delete the files. It would look like this:

-rwxrwx---   1 nobody  nobody  12288 Oct 24 00:22 avatar.png

It's not the ideal introduction to unix file permissions, but I hope this helps.

这篇关于在FTP中没有人拥有(99 99)由php函数引起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆