Can you find the error? I'm stumped

I have changed the tmp directory permissions to give full access to anyone and this still fails. And the weird thing is this is a portion of a previous job that has run on 160+ servers without fail and from the same BigFix server.

if { exists file “/tmp/temp.bash”}
delete "/tmp/temp.bash"
endif
move “__appendfile” "/tmp/temp.bash"
wait chmod 750 "/tmp/temp.bash"
wait “/tmp/temp.bash”

Completed delete __appendfile 
Completed appendfile "Test file written {now}" 
Completed delete "/tmp/temp.bash" 
Completed continue if {not exists file "/tmp/temp.bash"} 
Failed copy __appendfile "/tmp/temp.bash" 
continue if {exists file "/tmp/temp.bash"}

We can see that /tmp/temp.bash either didn’t exist or was deleted so the failed copy means you either don’t have rights to create & write to /tmp/temp.bash or can’t read __appendfile.

Next options to troubleshoot.

Put auditing on /tmp/ to see the errors
Try the same script but trying to create a differently named file in a different folder.
I’d also try it using createfile instead of appendfile to create the initial content
Just copy another file you know exists to /tmp/temp.bash

Thanks for the reply. What does “put auditing on” mean?

Auditing is the process of logging successful/unsuccessful file operations (be they read, write, create, delete, etc. etc.). You would do this to see what work/fails when creating/writing files in the folder.

I don’t know which OS you are using or the details of running it, so I’m not going to attempt to give you the instructions. Google is probably you friend for that.

So I just wanted to drop by on this thread I started to give you an update.

The folks that said I probably did not have the “rights” to write to the directory were correct. I was using a new Linux test lab server. This server is a SELinux box which is Linux OS with a higher level of security. When I switch to the standard RedHat Linux, the script worked fine. So thanks for trying to help.

TM: could you explain a little bit about turning on auditing?

Thanks everyone.

Ken

This is a Bigfix forum. I advise asking questions about auditing file system access on Linux on your preferred forum for your flavour of Linux.

I’m fairly new at BigFix. So when you mentioned “to put auditing on”, I thought that was something within BigFix scripting. Thanks for trying to help.

1 Like

[thread resurrection]

I just stumbled on to this bit…

More specifically, on many 'nixes the file at /bin/sh might be sh, or a copy of /bin/bash, or a link to /bin/bash. This comes into play because bash has hard-coded behaviors that are different if the binary is launched using the name “sh”.

If Bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well.

I have specific scar tissue because of this. :cry:

As such, @AlanM’s bit here :arrow_down:

:arrow_up: MIGHT be incorrect. It depends on the 'nix.

1 Like