Hello, I am trying to find the best way to setup a filedrop via SMB share or FTP. The reason is, that my multi-function printer can store scanned documents to either an FTP server or SMB share (nothing else). So, I was thinking: In theory I could share the file system to another Docker container (I have a Docker Compose setup) that is creating a SMB share of a sub-directory in my account. But afaik, the file will only be known by Nextcloud if I manually run a file system scan in Nextcloud.
The question is: Do you have any better ideas on how to achieve this? I want to be able to scan to my Nextcloud because I want to avoid having to setup SMB on all my PCs and configuring it on the printer for each PC separately.
I think this is not Nextcloud version-specific, so I will skip this information (please let me know I this is wrong).
Nextcloud does not offer SMB or FTP as a server service. Therefore, you always need an FTP server or SMB server as an alternative. Whether you subsequently integrate the FTP storage or SMB storage into your Nextcloud depends on whether you also want the data to be available in your Nextcloud.
More modern multi-function printers may be able to use WebDAV, which can be used to access Nextcloud directly.
I implemented a somewhat complicated solution using a separate VM for this, based on the instructions linked below. I did it this way because printers are a security nightmare and I would never let my printer access my Nextcloud VM or my Nextcloud directly, even if it would support WebDAV
Comment out the [printers] and [print$] sections like in the example below, or just delete them:
;[printers]
; comment = All Printers
; browseable = no
; path = /var/spool/samba
; printable = yes
; guest ok = no
; read only = yes
; create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
;[print$]
; comment = Printer Drivers
; path = /var/lib/samba/printers
; browseable = yes
; read only = yes
; guest ok = no
Add the following lines to the end of the file:
[scans]
comment = Scans folder
path = /opt/scans/
force user = scanner
force group = scanner
writeable = yes
valid users = scanner
If your scanner doesn’t support modern samba versions, add the following line to the [global] section of the file:
server min protocol = NT1
Restart the smb deanon:
sudo systemctl restart smbd.service
3. Configure Rclone
Create a folder “Scans” and an App-Password on the Nextcloud account you want to scan to. After that you can configure Rclone by typing rclone config and following the instruchtions:
rclone config
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> Nextcloud
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
[...]
31 / Webdav
\ "webdav"
[...]
Storage> 31
** See help for webdav backend at: https://rclone.org/webdav/ **
URL of http host to connect to
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Connect to example.com
\ "https://example.com"
url> https://cloud.yourdomain.tld/remote.php/dav/files/your-nextcloud-username/Scans
Name of the Webdav site/service/software you are using
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Nextcloud
\ "nextcloud"
2 / Owncloud
\ "owncloud"
3 / Sharepoint
\ "sharepoint"
4 / Other site/service or software
\ "other"
vendor> 1
User name
Enter a string value. Press Enter for the default ("").
user> your-nextcloud-username
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank (default)
y/g/n> y
Enter the password:
password: *the-app-password-previously-generatetd*
Confirm the password:
password: *the-app-password-previously-generatetd*
Bearer token instead of user/pass (eg a Macaroon)
Enter a string value. Press Enter for the default ("").
bearer_token> press ENTER
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
--------------------
[Nextcloud]
url = https://cloud.yourdomain.tld/remote.php/dav/files/your-nextcloud-username/Scans
vendor = nextcloud
user = your-nextcloud-username
pass = *** ENCRYPTED ***
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
Nextcloud webdav
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
Thank you all very much for the detailed answers. I think setting up another container with Samba and adding it as a external storage to Nextcloud sounds very elegant.