[scponly] setting a umask

Thomas Wana thomas at wana.at
Wed Apr 20 16:13:53 EDT 2005


Paul Jones wrote:
> I have scponly running pretty well now chrooting my users.  Is there a 
> way to set a easily umask for them?  I need to set the umask to 002.
> 
> Paul

umask in a scponly chroot is a bit of a problem; in my case, I had to
write a wrapper program that sets the umask and executes the real program
afterwards. In the case of 'svnserve', I copied the real svnserve binary
to svnserve.real and wrote the following fake-svnserve program:

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(int argc, char **argv, char **envp)
{
    umask(0002);
    argv[0]="/usr/bin/svnserve.real";
    execve(argv[0], argv, envp);
    return 0; // not reached
}

Tom



More information about the scponly mailing list