Friday 8 December 2023

Force group for new content

We have a shared directory, DATA, on our data server. The shared directory is in group mcc, and each user is also a member of this group. However, when users created files and directories inside this shared folder, permission defaulted to the user's group, and others could not access it.

To fix this, I used the following command for the shared directory:

chmod g+s DATA

I found that tip here.

Retrieve multiple files from sftp

I wanted to get GLEAM data from an sftp server. sftp doesn't seem to support wildcards with the get command, so instead I used a script:

for YYYY in 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005; do
  sshpass -p password sftp -P 2225 username@hydras.ugent.be:/data/v3.8a/daily/${YYYY} << EOF
  get E_${YYYY}_GLEAM_v3.8a.nc
  exit
  EOF
done