***GUIDE*** How to have SMBv1 for old Printers/Scanners/MFP without activating it in UnRAID


Recommended Posts

I was configuring a couple of old Multi-function printers today and realized they couldn't talk to UnRAID shares because by default, UnRAID doesn't have SMBv1 enabled (Netbios) and for good reason.

 

Some printers can do FTP but that's a different can of worms. So, I figured I could dockerize Samba, set it up for SMBv1 and then, using a script, copying the files from there to an UnRAID share that network users can use.

 

Note: I'm looking into presetting all this up and publishing it in Community Applications since there's no Samba docker already there but, in the meantime, you can follow these steps if you want to test it out. Suggestions are welcomed.

 

Follow these steps:

  • Create a Share in Unraid and name it "z_SMBv1" ("z_" is so it's at the end of your list). Set Export to "Yes (Hidden)" and Security to "Private". Do not give any user access. This share is our mount point for the container.
  • Create a Share in Unraid and name it "Scans". Set Export to "Yes" and Security to "Private". Give access to whatever users you want to be able to access the scanned files from their PCs.
  • Go to Dockers in UnRAID and click on "Add Container". Name it whatever you like (I've named it "SMBv1_Printers").
  • Set "Repository" to "dperson/samba"
  • Give it its own Fixed IP address ("Custom" under "Network Type").
  • Click on "Add another Path, Port, Variable, Label or Device".
  • Select "Path" as the Config type. Name it "Local Storage".
  • Container Path: /scanssmbv1
  • Host Path: /mnt/user/z_SMBv1/
  • Click on Save.
  • Click on "Add another Path, Port, Variable, Label or Device".
  • Select "Variable" as the Config type. Name it "USER".
  • Key: USER
  • Value: USER_OF_YOUR_CHOICE;PASSWORD_OF_YOUR_CHOICE
  • Click on Save.
  • Click on "Add another Path, Port, Variable, Label or Device".
  • Select "Variable" as the Config type. Name it "SHARE".
  • Key: SHARE
  • Value: scanssmbv1;/scanssmbv1;yes;no;no;USER_OF_YOUR_CHOICE_SPECIFIED_EARLIER
  • Click on Save.
  • Click on "Add another Path, Port, Variable, Label or Device".
  • Select "Variable" as the Config type. Name it "SMB".
  • Key: SMB
  • Value: disable
  • Click on Save.
  • That's it. Save and apply the container.
  • Once it starts up, go to your Printer/Scanner/MFC and tell it to send files to the docker container we just created: "CONTAINER_IP/scanssmbv1" and give it a try.
  • You can also try the share on a PC first if you want to make sure it worked. If you have write permission errors, you can use the "Docker Safe New Perms" option under "Tools" in Unraid. This should fix that issue.
  • Now, install the "User Scripts" app from Community Applications.
  • Go to Settings within said app.
  • Click on "Add New Script"
  • Name it whatever you like.
#!/bin/bash

SOURCE_DIR="/mnt/user/z_SMBv1"
DESTINATION_DIR="/mnt/user/Scans"

# Copy files from source to destination and delete from source afterwards
rsync -a --ignore-existing --remove-source-files "$SOURCE_DIR/" "$DESTINATION_DIR/"

 

  • Save the script.
  • Set the "Schedule" to "Custom".
  • On the Cron tab, add 5 asterisk (like this: * * * * *)
  • This script will move the scanned files from the SMBv1 Container share to the Scans Share and delete the source files every 60 seconds (this is the max amount of time you'll have to wait before seeing your scan in the Scans folder).

 

That's it. In theory, you can now use your old multi function printers or scanners that have a Scan-to-file/network option without explicitly enabling SMBv1 in your UnRAID.

 

In theory, obviously, this can work for any device that requires SMBv1 (the idea that led me to set this up to test, originally came from someone that had a Sonos device that wanted to read music files from an SMBv1 share from Unraid) so you can modify this accordingly.

 

You can even get fancy and if you have multiple printers, add folders within the SMBv1 share and the Scans share and change the settings accordingly (this is what I did). You can also add more shares if needed.

 

More info on samba variables to achieve other options here -> https://github.com/dperson/samba

image.png.57b119d6753b9ac61148357632da3ffe.png

 

image.png.4dd29514009e6a23bd98d02077ae31f8.png

 

image.thumb.png.304e8551a5ad30999eb0b8ef0bf91b4e.png

 

image.png.508e6bb37ef81c4b5fe72fbfd85178fc.png

 

image.png.ea46ab060e289b5064968affcdc72441.png

Edited by Soundwork
typo in code
  • Like 1
Link to comment
  • 2 months later...

guessing its your docker i found on dockerhub/github? these variables work for that? 

 

tried your guide but it says "/usr/bin/samba.sh: line 160: $2: unbound variable" and the container won't start

Edited by letrain
Link to comment

I used to use the dperson/samba container but it stopped working for my usecase in recent unraid versions as unraid's kernel dropped support for NTLMv1.

Had to move to a tiny Alpine VM.

It's possible it works again but I haven't retried, or that it's OK for printers.

Edited by Kilrah
Link to comment
8 minutes ago, Kilrah said:

I used to use the dperson/samba container but it stopped working for my usecase in recent unraid versions as unraid's kernel dropped support for NTLMv1.

Had to move to a tiny Alpine VM.

It's possible it works again but I haven't retried, or that it's OK for printers.

 

As far as I can tell, it's still working (my initial use case scenario is still in production and it's being used actively).

Link to comment
On 2/4/2024 at 10:32 PM, letrain said:

guessing its your docker i found on dockerhub/github? these variables work for that? 

 

tried your guide but it says "/usr/bin/samba.sh: line 160: $2: unbound variable" and the container won't start

There is a typo in the guide above,

Value: USER_OF_YOUR_CHOICE:PASSWORD_OF_YOUR_CHOICE

should have a semicolon between the USER and PASSWORD, not a colon.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.