I am making online file editor which works by SSH. It can connect to another SSH machine, read textarea, and make a remote SSH command with $textarea . What command shall i use, so it will change file called server.settings to contents of $textarea? Or some script?
Thanks in advance.
So, solution i made was: I echo'ed result from SSH command to textarea
tail -n 2000000000000000000 /root/server.log
Then made, that python will write the content from textarea to requested file.
I agree with Mark B this sounds dangerous. It would be much safer to have a service running on the machine that has the file to be modified, but I will assume you thought of that and that it's not an option.
A slightly safer way of doing it would be to use scp or sftp instead of ssh, so there's a smaller chance of arbitrary commands being run on the machine with the file to edit. So you would
I use shellinabox and there is no need for any of this. It is dead easy to chroot jail any clients connecting, and using screen I can have multiplexed terminals and persistent sessions.
$0.02