Background

When you work with a team and upload files in the download area, you want to use appropriate permissions so that other members of your team can also make change.

Savannah is specially configured for this task: the download areas carry the 'setgid' bit (chmod g+s) so that newly created directories belong to your project group. Moreover, the default umask for all SSH sessions is 002, which means members of your group will have write access to the files and directories you create.

Unfortunately, tools like scp and sftp do not always respect this:

  • new files sent via scp get the original file's permissions (sr #105830)
  • sftp breaks the setgid bit (chmod's mode is AND'd 0777) (sr #105838 )

How to set permissions

First, vote for this sftp bug:)

The simplest way is to correctly chmod your files before upload:

  • mode 664 (or ug=rw,o=r) for files
  • mode 2755 (ug=rwx,g+s,o=rx) for directories

Always remember to give group write access, so other members of your team can also manage the download area. Make sure the group is your project, not svusers, otherwise all Savannah members can alter your files.

One simple way to manage the download area is to maintain a local copy on your computer, synchronize it using rsync:

local$ cd /tmp
local$ mkdir -m 2775 mydir
local$ scp -rp mydir me@dl.sv.gnu.org:/releases/myproject/
# or
local$ rsync -a mydir/ me@dl.sv.gnu.org:/releases/myproject/mydir/
# or (shorter)
local$ rsync -a mydir me@dl.sv.gnu.org:/releases/myproject/

How to fix permissions for existing files

Eric Noulard suggested the following procedure for fixing directories, by downloading the whole download area, and uploading only the fixed directories:

mkdir myproject_da
scp -r erk@dl.sv.nongnu.org:/releases/myproject myproject_da
# myproject_da contains 'myproject/'
mkdir myproject_dironly
cd myproject/
find . -type d -exec mkdir ../myproject_dironly/{} \;
cd myproject_dironly/
chmod -R g+ws .
scp -rp myproject erk@dl.sv.nongnu.org:/releases/

This doesn't fix the directories group though.

To change a file group, you need to use the numerical id. Example, to change 'administration' to 'savane-cleanup':

sftp> ls -l
-rw-r--r--    1 Beuc     administration  6497801 Jun 24 18:14 savane-3.1-zeta.tar.gz
drwxrwsr-x    2 Beuc     savane-cleanup     4096 Jun 25 08:53 test-install
sftp> ls -ln
-rw-r--r--    0 68632    5038      6497801 Jun 24 20:14 savane-3.1-zeta.tar.gz
drwxrwsr-x    0 68632    6870         4096 Jun 25 10:53 test-install
sftp> chgrp savane-cleanup savane-3.1-zeta.tar.gz
You must supply a numeric argument to the chgrp command.
sftp> chgrp 6870 savane-3.1-zeta.tar.gz
Changing group on /srv/download/savane-cleanup/savane-3.1-zeta.tar.gz
sftp> ls -l
-rw-r--r--    1 Beuc     savane-cleanup  6497801 Jun 24 18:14 savane-3.1-zeta.tar.gz
drwxrwsr-x    2 Beuc     savane-cleanup     4096 Jun 25 08:53 test-install