_____ I have a Django website on my Linux server.
Goal : i want to make web jquery shell/bash of my Linux server , where my site is located , so i could directly from web site pass commands to linux and get all the outputs ,etc.
Questions开发者_JAVA技巧
Question 1: I know about new subprocess module and popen class , haven't tried it yet , but surely will but right now i experimented with os module. So why os.popen('ls -l') works , but os.open('ls -l >> somefile.txt') doesn't.
Questions 2: i know that when you use screen command somewhere in some file everything that is done is written to a file . Any idea where and what file it is ? Or which file contains everything that is output to bash ?
I am pretty sure that once i come home and try some more :D i will have much more concrete questions but for now that is all... Any suggestions or pointers where i should go , what i should read are appreciated. Thx in advance.
Do you plan to change SSH to web interface of terminal? I would not do that... You have amazing stuff called SSH and which allows you to perform even complex commands securely. I don't believe that you will manage to finish your "webterminal" with the same functionality. But you never know :) Think about transferring files though it, also security (how you will encode the input you will send, or you will just send it as a plain text? Of course https could help here also). I think you will have a lot of fun :)
P.S. I know this post isn't very helpful, but just wanted to make sure if you're not trying to reinvent the wheel...
Well i found an answer myself.
Didn't magically code it yet , but soon will . So as we all know we have a Linux command screen. This command can make logs of everything that is happening in your screen , by pushing "ctrl-A H" , who uses it knows. But the problem is, that logs are not written immediately , so it doesn't help much . But screen command has also another interesting command called hardcopy , which basically forcefully dumps all screen content copy to a file , where from you'll be able to get result as soon as you'll type it.
I maybe be not accurate and right about explanations of commands , but generally it works like this .
Security
I am in no way Linux expert , and haven't done it yet , but as much as i understand person is logged as user in a screen session , unless he knows root login and password or is super mega hacker which can obtain it, there is basically nothing he can do to destroy the system.
精彩评论