Soundwork Posted November 16, 2023 Share Posted November 16, 2023 (edited) 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 Edited February 7 by Soundwork typo in code 1 Quote Link to comment
letrain Posted February 5 Share Posted February 5 (edited) 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 February 5 by letrain Quote Link to comment
Soundwork Posted February 5 Author Share Posted February 5 Hi @letrain, Correct, I replied through there basically saying that I meant to keep that container private as it wasn't complete yet. As mentioned in the guide, you can use dperson's samba container for this -> https://github.com/dperson/samba Can you share your settings so I can figure out where your issue is? Quote Link to comment
Kilrah Posted February 5 Share Posted February 5 (edited) 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 February 5 by Kilrah Quote Link to comment
Soundwork Posted February 5 Author Share Posted February 5 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). Quote Link to comment
JohnHedge Posted February 7 Share Posted February 7 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. 1 Quote Link to comment
Soundwork Posted February 7 Author Share Posted February 7 10 hours ago, JohnHedge said: 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. You're completely right! I've now edited so it shows correctly. @letrain hopefully this solves your issue. Nice catch @JohnHedge! 1 Quote Link to comment
weeLz Posted February 12 Share Posted February 12 Could this work for a PS2 SMB Share? Quote Link to comment
Soundwork Posted February 15 Author Share Posted February 15 On 2/12/2024 at 12:47 PM, weeLz said: Could this work for a PS2 SMB Share? I'm not familiar with how PS2s work but as long as it uses SMBv1 for its protocol to access network shares, I do not see why not. Quote Link to comment
ParkerFlyGuy Posted April 6 Share Posted April 6 This worked great for me! I didnt like netbios being enabled and was considering gettting a whole new printer which seemed like a huge waste. Thank you so much!!! Quote Link to comment
Soundwork Posted April 8 Author Share Posted April 8 On 4/6/2024 at 10:19 AM, ParkerFlyGuy said: This worked great for me! I didnt like netbios being enabled and was considering gettting a whole new printer which seemed like a huge waste. Thank you so much!!! You're most welcomed Quote Link to comment
Kilrah Posted April 8 Share Posted April 8 On 2/5/2024 at 11:07 AM, Soundwork said: 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). Can confirm it works again, i'm back to container. Was broken for a few unraid versions and it seems it got fixed. BTW the dperson/samba repo hasn't been maintained for 4 years, even if it's "internal" so not much to worry about security I've moved to quay.io/unixfox/samba Quote Link to comment
Recommended Posts
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.