Symlink

I just played with symlink on the shell. I’m try to understand how sym.php from r.Alsa3ek and Al-Swisre are working.

Still can’t decode the code so I send the code to my old buddy to help me decode the code.

The first operation of the sym.php is to create a folder name sym and create symlink name root to /

So with my low knowledge of symlink i’d tried to simulate the scenario by manually  create some folder in the web root and create the symlink.

Then i chown it to username of the webroot using ROOT .

So what happen ? suddenly all scripts on the server were error and got 403.

I’m unconscious that i have been chown / to user.user LOL.

total 526
drwxr-xr-x 26 user user 4096 Jul 19 19:22 ./
drwxr-xr-x 26 user user 4096 Jul 19 19:22 ../
-rw-r–r– 1 root root 0 Jul 19 05:39 .autofsck
-rw-r–r– 1 root root 0 Jul 19 02:30 .autorelabel
drwx—— 2 root root 4096 Jul 19 05:39 .spamassassin/
drwx–x–x 4 root root 4096 Jul 20 17:05 backup/
drwxr-xr-x 2 root root 4096 Jul 20 04:25 bin/
drwxr-xr-x 4 root root 1024 Jul 19 04:18 boot/

Look at the ./ and ../

:P~

The lesson of this article is beware to use root account. Better use users account then sudoing and please understand where the symlink is link to 🙂