Skip to main content
deleted 1 character in body
Source Link
techraf
  • 6.1k
  • 11
  • 36
  • 51

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version


cat /proc/version

gives:

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

ThatsThat's the only output I can generate for any sort of release information.

 

edit2: allAll of the code:

$files = scandir('/volume1/dir1');
$base = "/volume1/";
foreach($files as $file) {
        $f_letter = $file{0};
        $new_path = $base . "ByLetter/" . strtoupper($f_letter) . "/" . $file;
        if(ctype_alpha ($f_letter) && !is_link($new_path)) {
                var_dump($base. "TV/" . $file);
                var_dump($new_path);
                symlink ($base . "TV/" . $file , $new_path);
        }


}

Running gives the same output for the var dumps both methods.

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

edit2: all of the code

$files = scandir('/volume1/dir1');
$base = "/volume1/";
foreach($files as $file) {
        $f_letter = $file{0};
        $new_path = $base . "ByLetter/" . strtoupper($f_letter) . "/" . $file;
        if(ctype_alpha ($f_letter) && !is_link($new_path)) {
                var_dump($base. "TV/" . $file);
                var_dump($new_path);
                symlink ($base . "TV/" . $file , $new_path);
        }


}

Running gives the same output for the var dumps both methods

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?


cat /proc/version

gives:

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

That's the only output I can generate for any sort of release information.

 

All of the code:

$files = scandir('/volume1/dir1');
$base = "/volume1/";
foreach($files as $file) {
        $f_letter = $file{0};
        $new_path = $base . "ByLetter/" . strtoupper($f_letter) . "/" . $file;
        if(ctype_alpha ($f_letter) && !is_link($new_path)) {
                var_dump($base. "TV/" . $file);
                var_dump($new_path);
                symlink ($base . "TV/" . $file , $new_path);
        }


}

gives the same output for the var dumps both methods.

Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
added 575 characters in body
Source Link
exussum
  • 4.2k
  • 5
  • 21
  • 21

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

edit2: all of the code

$files = scandir('/volume1/dir1');
$base = "/volume1/";
foreach($files as $file) {
        $f_letter = $file{0};
        $new_path = $base . "ByLetter/" . strtoupper($f_letter) . "/" . $file;
        if(ctype_alpha ($f_letter) && !is_link($new_path)) {
                var_dump($base. "TV/" . $file);
                var_dump($new_path);
                symlink ($base . "TV/" . $file , $new_path);
        }


}

Running gives the same output for the var dumps both methods

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

edit2: all of the code

$files = scandir('/volume1/dir1');
$base = "/volume1/";
foreach($files as $file) {
        $f_letter = $file{0};
        $new_path = $base . "ByLetter/" . strtoupper($f_letter) . "/" . $file;
        if(ctype_alpha ($f_letter) && !is_link($new_path)) {
                var_dump($base. "TV/" . $file);
                var_dump($new_path);
                symlink ($base . "TV/" . $file , $new_path);
        }


}

Running gives the same output for the var dumps both methods

Tweeted twitter.com/#!/StackUnix/status/480119320031535104
Notice added Draw attention by exussum
Bounty Started worth 50 reputation by exussum
added 268 characters in body
Source Link
exussum
  • 4.2k
  • 5
  • 21
  • 21

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

I have a PHP script running which makes symlinks.

To confirm which user it is:

file_put_contents("testFile", "test");
$user = fileowner("testFile");
unlink("testFile");
echo "running as user '" . $user . "'";
var_dump( exec('whoami'));

running like this ...

$ php script.php

runs correct all symlinks are made and output is:

running as user '999'string(5) "admin"

Running through a shell script:

#!/bin/sh
php /path/to/script.php

gives the following output and doesn't work:

PHP Warning: symlink(): Permission denied in /path/to/script.php on line 8 running as user '999'string(5) "admin"

I'm not sure what the difference between the two is, as the users they are running as are identical.

Any suggestions on how to make them both have the correct permissions for symlinking?

Edit: cat /proc/version

gives

Linux version 2.6.39 (root@cross-builder) (gcc version 4.6.3 (x86 32-bit toolchain - ASUSTOR Inc.) ) #1 SMP PREEMPT Thu Oct 31 21:27:37 CST 2013

Thats the only output I can generate for any sort of release information

deleted 1 character in body
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897
Loading
Source Link
exussum
  • 4.2k
  • 5
  • 21
  • 21
Loading