I have asterisk running with root and try to execute
exten => _.,1,System(cp /tmp/test.txt /usr)})
the file test.txt is in the /tmp folder
but it just won’t copy, any idea why?
I try SHELL, but the same.
although “rm”, deleting a file works.
thank you!
First, your matching on _. is a bad idea.
Second, use the full path to cp (most likely /bin/cp)
Third, check permissions. Can you execute /bin/cp from user asterisk (assuming your daemon run under that user) ? Can you write to /usr ?
Afaik, this is not an Asterisk issue.
- System(cp /tmp/test.txt /usr)
/tmp/test.txt is the full path
-
System(rm -f /tmp/test.txt) works fine so I think the path is correct
-
yes, if I execute cp /tmp/test.txt /usr it works under the shell as root
-
I think I run asterisk as root also, not as user “asterisk”. But how do I check? I compile asterisk under the root user.
Yes I know you going to say using root running asterisk is bad, but this is test and is only internal, not expose to external.
Full path for the binary: /bin/cp
ps aux | grep asterisk
And look who owns the asterisk process