It could be using the value of TMPDIR or TEMPDIR environment variables. You could try setting this to a different directory and see if the program uses that instead. Perhaps it is a config setting.
If you're able to delete the /tmp directory or everything in in it, as a non-root user, then your permissions seem wrong.
The permissions I have on my system are:
drwxr-xr-x 26 root root 4096 2009-10-14 12:00 /
drwxrwxrwt 27 root root 12288 2009-10-19 16:10 /tmp
The / directory only allows root to delete top level directories and the sticky bit on /tmp only allows owners to delete their own files in /tmp. Obviously, you would need root to correct these problems.
Assuming it uses the unlink function to delete the files, you can create a small shared library that you preload, which overrides the system unlink function.
Create unlink.c containing:
int unlink(const char *pathname) {
return 0;
}
int unlinkat(int dirfd, const char *pathname, int flags) {
return 0;
}
We also override the unlinkat function too in case it uses that.
You can now run:
% gcc unlink.c --shared -o unlink.so
% file unlink.so
unlink.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, not stripped
% touch foo
% LD_PRELOAD=./unlink.so rm foo
% ls foo
foo
If you find that your program needs to delete other files, you can make your replacement functions more intelligent, by for example, checking the path that's being asked to be deleted.