3

What am I trying to do?

I'm writing a code evaluator using chroot and python and went to hackerrank for some inspiration.

What I think is happening at Hackerrank?

Hackerrank creates run-XXXXXXXXXXXXXXXXXXXX folder for every run of a user program submission, each of these folders has a unique owner and only it's owner has read/write access to it. This means that a particular user 15307 cannot read/modify the contents of the other folders present.

Coming to the question

How would someone go about implementing this using chroot and python or any other language for that matter? Is it creating a user everytime?

Output of ls -al
total 140
drwxrwx--x  2 15307 15307   4096 Jun 24 19:17 .
drwxr-xr-x 68 root      0 118784 Jun 24 19:17 ..
-rw-r--r--  1 15307 15307      0 Jun 24 19:17 compile.err
-rw-rw----  1 15307 15307      0 Jun 24 19:17 error00000.err
-rw-r-----  1 15307 15307     27 Jun 24 19:17 input00000.in
-rw-rw----  1 15307 15307      0 Jun 24 19:17 output00000.out
-rwxrwx---  1 root      0    783 Jun 24 19:17 request.json
-rw-rw----  1 15307 15307     52 Jun 24 19:17 solution.py
-rw-r--r--  1 15307 15307    213 Jun 24 19:17 solution.pyc
Output of ls -al /
total 504
drwxr-xr-x  68 root       0 118784 Jun 24 19:17 .
drwxr-xr-x  68 root       0 118784 Jun 24 19:17 ..
drwxr-xr-x   3 ubuntu     0   4096 Jan 25 11:41 android
drwxr-xr-x   2 root       0   4096 Apr  9 06:30 bin
drwxrwx--x   2  17450 17450   4096 Jun 24 19:08 custom-H8tFpKOEWGsc0s6lvpRk
drwxrwx--x   2  14667 14667   4096 Jun 24 19:15 custom-QiOC2dqgU3pVUlFU4ZWz
drwxr-xr-x  13 root       0   3860 Jun 24 19:08 dev
drwxr-xr-x  10 root       0   4096 May  6 05:37 etc
drwxrwx--x   2  18227 18227   4096 Jun 24 19:13 game-player1-YeDYLpA2uIqJFeZ3d97T9IuRAKoqDhyM
drwxr-xr-x   4 root       0   4096 May  6 05:37 home
drwxr-xr-x  21 root       0   4096 Jun 21 06:36 lib
drwxr-xr-x   2 root       0   4096 Jun 21 06:36 lib32
drwxr-xr-x   2 root       0   4096 Jun 21 06:36 lib64
drwx------   2 root       0  16384 Jan 25 09:18 lost+found
drwxr-xr-x   5 root       0   4096 Jan 25 14:10 opt
dr-xr-xr-x 127 root       0      0 Jun 24 19:08 proc
drwxr-xr-x   7 root       0   4096 Jun 21 10:30 root
drwxr-xr-x  22 root       0    800 Jun 24 19:08 run
drwxrwx--x   2  15307 15307   4096 Jun 24 19:17 run-1KpGsxE8tJkf4JZhNa3O
drwxrwx--x   2  19186 19186   4096 Jun 24 19:12 run-1a89kLrOIvxSKmcG8Vxf
drwxr-x---   2 root       0   4096 Jun 24 19:13 run-1tPF28PnLjSHnwiPQQKw
drwxrwx--x   2  18229 18229   4096 Jun 24 19:12 run-1z3LUuz9SddZHYtT6DXl
drwxrwx--x   2  17407 17407   4096 Jun 24 19:14 run-2KfLhB5KQJ9hFnT32apd
drwxrwx--x   2  13423 13423   4096 Jun 24 19:15 run-2kNHf7UsoOBjeQI2Tcbk
drwxrwx--x   2  13477 13477   4096 Jun 24 19:12 run-6fuBJP7ZgZfEm2k9vkZV
drwxrwx--x   2  14824 14824   4096 Jun 24 19:08 run-8MlwJE1ia8bR86MbVYi8
drwxrwx--x   2  15984 15984   4096 Jun 24 19:13 run-A3YDoqR2J9cGAhILYDqZ
drwxrwx--x   2  16989 16989   4096 Jun 24 19:16 run-AQQjyqXYSXeFZ9wzI5dy
drwxrwx--x   2  18819 18819   4096 Jun 24 19:15 run-AvAUgIkcFtieewAFZ6dZ
drwxrwx--x   2  13189 13189   4096 Jun 24 19:14 run-FldwZMBI51tvTI3bzTqf
drwxrwx--x   2  15862 15862   4096 Jun 24 19:08 run-GORpHssv6tp0WFktcKlE
drwxrwx--x   3  15041 15041   4096 Jun 24 19:14 run-GmRpaAqK23cjuC3opP6G
drwxrwx--x   2  12977 12977   4096 Jun 24 19:12 run-zlriB5scmjE0ASSjie2r
drwxr-xr-x   2 root       0   4096 Jun 21 06:37 sbin
drwx------   3 root       0   4096 Jun 24 19:08 store
drwxrwxrwt   4 root       0   4096 Jun 24 19:17 tmp
drwxr-xr-x  14 root       0   4096 Jan 25 11:36 usr
drwxr-xr-x   6 root       0   4096 May  2 16:53 var

0

You must log in to answer this question.

Browse other questions tagged .