Have one SFTP with own folder for every user

Hello, is there any way to have one SFTP server and every user will have own folder for their files?

hello @FungY911 welcome to the community :handshake:
we don’t talk about “SFTP” here. yes Nextcloud provides personal and shared storage to multiple users and you can access it using different ways like desktop client, WebDAV and web interface but not with SFTP :wink:

So how can i achieve it?

As has already been said: With Nextcloud, you can’t. Nextcloud does not act as an SFTP server.

Maybe i wrote it bad, but i mean that nextcloud will connect to SFTP and create on that server folder for every user. Same as on normal disk…

There is an External Storage feature, which can also do SFTP. But I don’t know whether this can be used as primary storage. But it’s definitely worth taking a look.

An alternative would be to mount the SFTP with SSHFS on your Nextcloud-Server at the location where the Nextcloud data directory is located.

Okay, and is there way to make default disk for every user diferrent?

No, but but depending on what your goal is, you can set the quota for the “home” directories of your users to 0 and then provide separate external storage mounts to each user via the External Storage app. That way they can’t write anything to their home folders and are forced to use the external storage.

Or you could move the hole nextcloud datafolder to an external storage that is mounted to the file system of your server. However, for performance reasons I wouldn’t recommend to put the Nextcloud data folder on an SFTP/SSHFS mount.

Hey, i have a problem.

docker-compose.yml:

  nextcloud:
    container_name: nextcloud
    image: nextcloud
    ports:
      - "8080:80"
    volumes:
      - /media/remote-SDCard:/var/www/media/remote-sdcard
      - /nextcloud_docker/nextcloud:/var/www/html
    restart: always

When want to link it, i get:

{
    "id": 2,
    "mountPoint": "nameOfMount",
    "backend": "local",
    "authMechanism": "null::null",
    "backendOptions": {
        "datadir": "\/var\/www\/media\/remote-sdcard", // When i try to create subdir it does not work too.
        "isExternal": true
    },
    "priority": 150,
    "mountOptions": {
        "encrypt": true,
        "previews": true,
        "enable_sharing": false,
        "filesystem_check_changes": 1,
        "encoding_compatibility": false,
        "readonly": false
    },
    "status": 1,
    "statusMessage": "Local storage path does not exist \"\/var\/www\/media\/remote-sdcard\/\"",
    "userProvided": false,
    "type": "system"
}```

Thanks.

See Usage of variables for mount paths for one approach.

1 Like

/media/remote-SDCard:/var/www/media/remote-sdcard

Inside your container, what do the file ownership and permissions look like for /var/www/media/remote-sdcard?

Since it’s a bind mount, you’ll have to figure out permissions on the host side of this mount as well as the container side.

root@92ec5a03bca9:/var/www/html# ls -ld /var/www/media/remote-sdcard/
drwxrwxrwx 1 root root 0 May 28 18:11

Can you confirm you’re not getting anything else logged in your actual Nextcloud log just before the “Local storage does not exist”?

What, precisely is “/media/remote-SDCard”? Is it just a an sdcard or what? Want to make sure there isn’t more here like NFS/SMB/etc since it’s labeled “remote”.

What happens if you do a touch /var/www/media/remote-sdcard/blah from inside the container?

Oh, make sure you’re testing inside the container as the www-data user: GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud You appear to be exec’d in as root.

It is SDCard under SSHFS with FRPS connected to my home server.

When i do touch it is working.
and Yeah, it is under www-data

Anything new?

Hey? No new info?