root access | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

root access

when I try this int main() { system("whoami"); return 0; } the output is : root do I have root access, I am a bit confusing plus can anyone explain how the files get deleted automatically after the end of the program meaning when I type system("touch file.txt"); a file name "file.txt" will be created, and after running the program once again with system("ls"); the file is no longer there, I mean this is possible but just wondering how?

18th Feb 2021, 4:50 PM
Alpha Zero
Alpha Zero - avatar
10 Answers
+ 5
Sololearn runs programs as root. Yet that doesn't help you much since the filesystem is largely read-only and the whole container will replaced every time someone executed a program. So you can't store data between two executions of your program.
19th Feb 2021, 7:35 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
no I'm just trying to understand how files you create within the terminal deleted automatically BTW you can compile a file.txt in c++ if you specify that "file.txt" is a c++ to the compiler u can do it by g++ -x c++ file.txt
18th Feb 2021, 5:09 PM
Alpha Zero
Alpha Zero - avatar
+ 1
Tell me plz. Is your programm file.c compiled and works? Why you are not trying syscall?
18th Feb 2021, 5:29 PM
SERG Starkov
SERG Starkov - avatar
+ 1
cheked your prog. It's work.
18th Feb 2021, 5:33 PM
SERG Starkov
SERG Starkov - avatar
+ 1
yes, my question wasn't about c++ I'm trying to understand how SoloLearn server works. you can do: system("ls") and discover
18th Feb 2021, 5:37 PM
Alpha Zero
Alpha Zero - avatar
18th Feb 2021, 5:57 PM
SERG Starkov
SERG Starkov - avatar
0
Waite a minute i try your code
18th Feb 2021, 5:00 PM
SERG Starkov
SERG Starkov - avatar
0
Tell me plz, are You trying run C Program from file. txt? If so. Dont try. Nothing Will be done.
18th Feb 2021, 5:04 PM
SERG Starkov
SERG Starkov - avatar
0
I see. Ok. Its intresting to explore how SoloLearn server works. I want to understand this too.
18th Feb 2021, 5:54 PM
SERG Starkov
SERG Starkov - avatar
0
exactly 🤗
18th Feb 2021, 5:58 PM
Alpha Zero
Alpha Zero - avatar