The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Move files from one acct to another

Discussion in 'cPanel Developers' started by jhyland87, May 21, 2009.

  1. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    so, I am making a php script that will create an account under a reseller account, and then install wordpress, but I am having some problems...

    How can I move a folder with a ton of files from one user, to another user.. any idea? Is their a cpanel command I can execute with php?

    I have tried a few things, but due to permissions, pretty much everything fails..

    Basically..

    how can user "justin1" perform the action
     
  2. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    Keep in mind this is on a shared server, so im trying to find the most secure way..
     
  3. JPC-Shaun

    JPC-Shaun Well-Known Member

    Joined:
    Oct 29, 2008
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Hi;

    Try to be specific either you want to copy or move the files/folders. Move 'mv' and copy 'cp' are basically the same with move having another step of erasing the original file. The procedure is that for copy, the file is copied and the original file remains where it was. For move, the file is copies then the original file is erased so the file appears to have been "moved" to another location. 'mv' moves a file from one location to another, leaving no duplicate in the original location. 'cp' Copy makes a copy in a new location.

    To preserve the Ownerships of the files while copying it to some other location you can use the -pR switch as below:

    cp -pR /path/of the/source /path/of the/destination

    This will copy recursively and preserve all the file/folder permissions.

    Generally when files are moved from one account to another the owner ships must be fixed according to the destination account. Like in your case the files/folders owner ships must be 'justin2' once they are moved or copied to the new location
     
  4. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    It would be a copy, sorry for not being specific.

    I dont want to preserve the ownership when I move the files, Id like the chown to change, and the chmod to stay the same.

    Hard to explain I guess...

    Justin1 has the cpanel access key, because its the reseller, ALSO has the /wordpress/ directory..

    Justin1 sends commands to make Justin2, which works fine, now Justin1 needs to copy /wordpress/ to Justin2... Permissions stop me from doing anything.

    I tried to run a shell script from the Justin1 account that would copy the files from Justin1 to Justin2, and the script was owned by root, but chmod to 777, but it still gave permissions because i was running it under Justin1..
     
Loading...

Share This Page