I have a bash script that copies over files from local to remote server using scp. Once all of the transfer is done, I run chmod command over the ssh to open up all of the permission. The problem is that it intermittently works and does NOT chmod 777 properly all the time. Any way I can verify that chmod command executed definitely (maybe using return code or something)? I do have my ssh keys setup so I do NOT need to enter password upon doing ssh or scp. Below is the snippet of my code
#copy over the files from local machine to remote server
scp file1.txt file2.txt file3.txt 10.111.222.333:/home/user1/fileDir/
#open up the permissions on the remote server
ssh -qX 10.111.222.333 chmod -R 777 /home/user1/fileDir
ssh
command should reflect that of thechmod
command -- that is, ifchmod
gets an error,ssh
should return a nonzero code as well. – Gordon Davisson