Freebsd umask support

I am trying to get all files written by syncthing to rw-rw-r-- but it keeps defaulting to rw-r–r-- even with ignore permissions enabled.

I’ve fixed login.conf with umask 002 but that won’t work as syncthing is launched as a daemon. So I’ve added “umask” in the syncthing_startprecmd() section of /usr/local/etc/rc.d/syncthing

Restarted syncthing but all file writes still end up as 644’s.

Any other idea on what else to look at?


You need to set ignore permissions on the folder for syncthing to respect umask.

Other than that, seems like a freebsd question with which I am not sure I am able to help with.

Ignore permission has been set on the folder.

No problem, thanks anyway.

I’ll also pose the same question in the freebsd forum.

I don’t know the freebsd rc system well, but the umask change needs to happen in the shell or process that starts syncthing for it to inherit it. Perhaps there’s some issue there.

Yup it does.

I suppose the precmd script does that. Here is the precmd that I modified:

. /etc/rc.subr


load_rc_config $name

: ${syncthing_enable:="NO"}
: ${syncthing_home=/usr/local/etc/syncthing}
: ${syncthing_log_file=/var/log/syncthing.log}
: ${syncthing_user:="syncthing"}
: ${syncthing_group=${syncthing_group:-$syncthing_user}}

command_args="-cf -p ${pidfile} ${procname} ${syncthing_home:+-home=${syncthing_home}} ${syncthing_log_file:+-logfile=${syncthing_log_file}} -no-browser ${syncthing_args}"


        umask 002
        echo "umask sorted"

        if [ ! -e ${pidfile} ]; then
                install -o ${syncthing_user} -g ${syncthing_group} /dev/null ${pidfile};

        if [ ! -d ${syncthing_home} ]; then
                install -d -o ${syncthing_user} -g ${syncthing_group} ${syncthing_home}

        if [ ! -e ${syncthing_log_file} ]; then
                install -o ${syncthing_user} -g ${syncthing_group} /dev/null ${syncthing_log_file};
run_rc_command "$1"

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.