Permission denied while attempting to save a recording

Hi,

Any time I try to save a system recording on FreePBX 2.5 I get the following:

[ERROR] SAVING RECORDING:
cp: cannot open `/tmp/9999-ivrrecording.wav’ for reading: Permission denied
Make sure you have entered a proper name

[ERROR] REMOVING TEMPORARY RECORDING:
cp: cannot open `/tmp/9999-ivrrecording.wav’ for reading: Permission denied
Make sure Asterisk is not running as root

“9999” is the extension number the recording was performed from.

File /tmp/9999-ivrrecording.wav had permissions set as 600 asterisk,asterisk.

I tried to manually change permissions to 660 asterisk,asterisk. That allowed me to proceed with the new recording registration in the system. But I still got:

[ERROR] REMOVING TEMPORARY RECORDING:
Make sure Asterisk is not running as root

an sure enough the file was not removed.

Any thoughts?

Thank you,
Vladimir Mikhelson

yes one of the errors it gave you is the issue.

Make sure Asterisk is not running as root. Please check it. The proper way to start and stop asterisk and FreePBX is by using the amportal start|stop command.

At the same time run amportal chown which will reset the permissions and ownership rights to the correct values.

Hi fskrotzki,

Thank you for your reply.

I verified the Asterisk was not running as “root” since it was obvious from the error message. It was running as “asterisk.”

I had run “amportal chown” before to no avail.

Any other suggestions?

Thank you,
Vladimir Mikhelson

without knowing a lot more about your setup it’s hard to guess. This a ISO build, hand build, if hand built who’s directions, etc…

None of the errors provided here make is clear that is is running as asterisk but imply that it is probably running as root. "[ERROR] REMOVING TEMPORARY RECORDING:
Make sure Asterisk is not running as root "

Let’s walk through the errors you provided one by one.

The first one: cp: cannot open `/tmp/9999-ivrrecording.wav’ for reading: Permission denied, Make sure you have entered a proper name
Make sure that you are only using the standard letters and numbers to start as many symbols cause a problem if the are not escaped correctly. Also remember if you are a windows user that there is a difference between upper and lower case in unix. (Don’t mean to insult just don’t know your background).

The second one:
[ERROR] REMOVING TEMPORARY RECORDING:
cp: cannot open `/tmp/9999-ivrrecording.wav’ for reading: Permission denied
Make sure Asterisk is not running as root

This is generated 95% of the time when asterisk is running as root instead of as asterisk. The proper way to start and stop asterisk with FreePBX is by using the amportal start and stop commands. the other 5% of the time it is from people who have hand build systems, and don’t follow the directions about setting up apache to run as the user asterisk or they stopped asterisk and started it again as root.

For the temp file the permissions and such were correct, they are also set by asterisk not FreePBX when the file was created.

Same exact problem,

[ERROR] SAVING RECORDING:
cp: cannot open /tmp/200-ivrrecording.wav' for reading: Permission denied Make sure you have entered a proper name [ERROR] REMOVING TEMPORARY RECORDING: cp: cannot open/tmp/200-ivrrecording.wav’ for reading: Permission denied
Make sure Asterisk is not running as root

build is from AsteriskNow 1.5. Nothing has been change from initial install except trunk configuration.

I ended up changing Apache User and Group to “Asterisk” from the original “Apache” in httpd.conf.

I am also on AsteriskNow 1.5

Hope it helps,
Vladimir Mikhelson

far from a single command:

chmod 777 -R /var/lib/asterisk/sounds/custom

that is all.

I am not sure that it is the best idea to solve any problem by wide opening an otherwise secured directory to the world.

if File /tmp/9999-ivrrecording.wav have permissions set as 600 asterisk,asterisk.

Change AMPVMMASK=007 in /etc/amportal.conf, it set permissions as 660 asterisk.asterisk to nnnn-ivrrecording.wav file and fix copy.

This is what the /etc/amportal.conf comments say:

AMPVMUMASK: defaults to 077 allowing only the asterisk user to have any permissions on VM files. If set to something

like 007, it would allow the group to have permissions. This can be used if setting apache to a different

user then asterisk, so that the apache user (and thus ARI) can have access to read/write/delete the

voicemail files. If changed, some of the voicemail directory strucuters may have to be manually changed.

Pay attention to the, “If changed, some of the voicemail directory strucuters may have to be manually changed.”

BTW, the latest FreePBX 2.8 does not exhibit the problem with its standard configuration.