代码之家  ›  专栏  ›  技术社区  ›  M.Bwe

从php脚本ubuntu更新、复制文件

  •  0
  • M.Bwe  · 技术社区  · 7 年前

    我有一个用php语言开发的freeradius管理系统 我想将freeradius文件夹中的文件1复制到同一文件夹中的文件2 但即使我设置了www数据的权限,我也不能这样做 我用这个代码复制文件

    exec('cp /etc/freeradius/modules/file1  /etc/freeradius/modules/file2');
    

    的结果 ls -l /etc/freeradius/modules/file1

    -rwxrwx--- 1 www-data freerad 0 Dec 15 10:28 /etc/freeradius/modules/file1
    

    我的错在哪里?我该怎么做?

    2 回复  |  直到 7 年前
        1
  •  0
  •   Marco Paolo Martegani    7 年前

    我不确定您的代码有什么问题,但您可以尝试以下方法: 复制(“/etc/freeradius/modules/file1”,“/etc/freeradius/modules/file2”);

        2
  •  0
  •   M.Bwe    7 年前

    是的,错误是我没有权限从www数据用户访问freeradius文件夹,所以当我通过www数据设置freeradius所有者时,问题就解决了