Your CGI script gets run as the user
apache, probably, which isn't you.
This means:
- It won't be running in /home/myusername
- It won't have a decent PATH, so won't find lots of common commands
- It won't have permissions to mkdir /home/myusername/newfolder
- It won't try /home/myusername/.ssh/id_dsa for passwordless logins
- It won't have permission to read /home/myusername/.ssh/id_dsa anyway
- You won't see your error messages since the CGI interface diverts them all into /dev/null
- You may not be able to get them back because perl is extremely bad at redirection
I repeat. system() isn't an alternative to shell scripting.
system() is an entire, real shell. System is actually
the same shell you were hoping to avoid by using perl!
You are running shell scripts.
You are loading entire bourne shells, running single 'mv file1 file2' commands in them, quitting entire shells, then doing it again, over, and over, and over. You are running, potentially, dozens or hundreds of tiny, individual, shell scripts.
And you're running them in an especially slow, wasteful, and bug-prone way, having to tiptoe around perl to get the raw text you wanted into and out of the shell. You can't even get your error messages!
If you post your perl code, I'll show you how to do it in a shell script, and show you how to do it in a way that will work in CGI.