I use an expect script to automate transfer of some support files onto terminals. The support files are automatically tarballed before being scp'ed onto the target terminal. This is accomplished by an in-house expect program that automatically fills out the password for the scp so we don't have to put the password in. I can copy the individual files without issue, but when I try to copy the tar.gz file, it changes the permissions of the /tmp directory. I have been chmodding the /tmp directory back to 1777 for the permissions and chowning it to root.root, which is how it is normally set up, but this doesn't always work. It is causing sqlite errors due to sqlite not being able to write a temp file to /tmp, which is very disruptive. How can I determine the exact cause of this? I know it has to be related to the tar.gz file, but I was under the impression that tar would preserve the permissions on the file.
the permissions on the file inside my directory are:
-rw-rw-r-- 1 aembree aembree 88K Oct 2 15:20 dropin.tar.gz
Before the transfer /tmp looks like this in an ls -al:
drwxrwxrwt 15 root root 8.4K Oct 2 15:08 tmp
After the transfer /tmp looks like this:
drwxrwxr-x 15 10539 10539 8.4K Oct 2 15:01 tmp
The tar command being run is the following:
tar -vPczf /home/aembree/bin/resources/dev/dropin.tar.gz --exclude='helperscript' -C $dropinlist . > /home/aembree/bin/resources/logs/tarlog
Once the file is on the remote machine, expect executes the following command to unpack it:
send "cd /tmp ; tar -xzf dropin.tar.gz ; rm dropin.tar.gz ; cd ;\n"