Fix owner from symlink release
tislars opened this issue · 1 comments
tislars commented
Our server is accessed as root
, but the site folders are owned by a different user (e.g. foo.com has owner:group foo:client
).
I have written the following custom task and all the content is set to the correct group and owner:
<?php
namespace Task;
use Mage\Task\AbstractTask;
class FixPermissions extends AbstractTask
{
public function getName()
{
return 'custom/fix-permissions';
}
public function getDescription()
{
return 'Fixing file ownership and permissions';
}
public function execute()
{
$owner = $this->options['owner'];
$group = $this->options['group'];
$cmd = "chown ".$owner.":".$group." -R .";
$process = $this->runtime->runCommand($cmd);
return $process->isSuccessful();
}
}
But the symlink created after deployment is root:root
and I can't seem to change this to foo:client
.
How could this be done?
andres-montanez commented
Hi, the premise is that the user connecting is not root :)
I understand that you may need that, in this case to change the symlink you need to pass -h to the chown command.
Hope this helps!