Skip to content

unix domain sockets are created with the wrong owner #64

Closed
@redneb

Description

@redneb

Suppose that you are running gocryptfs as root with the -allow_other option. Then if a non-root user creates a (regular) file in the gocryptfs, it will be owned by that user. But that doesn't seem to happen with unix domain sockets, they are instead always owned by root.

Here's how to reproduce this (with the help of socat):
As root, run the following:

mkdir /tmp/gocryptfs-sock-test{,.enc}
gocryptfs -init -extpass="echo test" /tmp/gocryptfs-sock-test.enc
gocryptfs -allow_other -extpass="echo test" /tmp/gocryptfs-sock-test{.enc,}
chmod 0777 /tmp/gocryptfs-sock-test

Then as a non-root user run this:

socat unix-listen:/tmp/gocryptfs-sock-test/test.sock -

You can check now that the socket /tmp/gocryptfs-sock-test/test.sock will be owned by root.

encfs with the --public option, doesn't seem to have that problem:

# as root:
mkdir /tmp/encfs-sock-test{,.enc}
encfs --public --standard --extpass="echo test" /tmp/encfs-sock-test{.enc,}
chmod 0777 /tmp/encfs-sock-test

# as non-root:
socat unix-listen:/tmp/encfs-sock-test/test.sock -
# /tmp/encfs-sock-test/test.sock is owned by the non root user

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions