When I was getting permission denied, because permissions on NAS were too restrictive. I was restricting to my local network IP range (192.168.8.0-255), but HassOS when connecting, showing it’s docker IP (something like 172.30.32.2). Maybe same thing with your NAS setting?
If not, try sharing security configuration of your NAS - we’ll brainstorm from there on.
Thanks for the reply @insajd
Good idea, but just tried to check the IP restrictions and I do not think i have this on my NAS. At least for SMB.
I use unRaid for my NAS, none of the usual restrictions I can see, and everyhting I have lifted just to try get this thing working at the baselevel to then build complexity on top of.
I dont see any attempts in my NAS logs either from HA trying to connect. I am fresh out of ideas now.
Screens below of the SMB settings in the admin portal
No new ideas after seeing your settings…
I’ll shoot some ideas and questions:
Is unraid and hassos on the same machine?
Can you ping nas from hassos? Ping from other machines in local network?
Does nas has some firewall in it?
Try adding -v option to mount command, it should add verbose output.
I was getting the same thing when trying to connect my Synology NAS. What ended up working for me was actually running the command through an automation. I had the commands setup as a shell_command and ran that shell_command from the automation.
I could not see the mount point from the CLI after running from the automation. I’m not too experienced with docker yet so my assumption is that the mount point is in a different location than what is accessible from the CLI.
Either way, I would love a better solution because if you need to change the command in any way or unmount it, you have to create new shell_command to unmount and then change settings, each requiring a HA restart between each.
-v didnt output anything new, does that work with the mount command?
As to the setup details. Networking wise:
HASSOS is a separate machine (Intel NUC)
UnRaid (NAS) is a different server all together, basically custom built
Both devices connect to the same switch and also same subnet (its a flat network)
HASSOSS and NAS connect to eachother and i have my HA smb shares mounted on the NAS for back up purposes so no restirctions there, ping runs fine network is fine
NAS has a simple firewall, but that isnt the issue as it allows smb connections to the server from other machines
Overall the NAS works fine, its only when I try to connect to the SMB share from HA that I get this issue, never had any propblems with this share on anyother device.
As a test I booted up my Ubuntu VM on my laptop and was able to mount the SMB share to Ubuntu. So everything works, apart from HA refusing to play! Command used for test:
mount -t cifs -o username=USER,password=PASSWORD,domain=WORKGROUP //192.168.1.20/nvr-cctv /mnt/media2
@Cyberfighter - How do you know that the shell_command mounted the share? how do you confirm this in the HA GUI?
I’ve created the shell_command and when i run the service there is nothing that lets me to believe that its mounted?
This is why i tried to see if it even mounts from the CLI running as root?
MAN! you were right! it doesnt work in CLI for soem daft reason been needlessly chasing my own tail…
@insajd original method works i was just being an idiot!
For anyone else who may be in the same boat as me this is where i went wrong, didnt understant how the media browser works!
So missing the following in my configuration.yaml
Glad you fixed it. One note though, after HA upgrade you’ll probably need to connect to the ha and recreate the /mnt/media2 folder. Not to do it, add “mkdir -p /mnt/media2;” before mount command in shell_command.
Guys, i need also add my NAS folder to my Mediabrowser folder in Hassios, but no success, I get permission denied when i do that via de Terminal addon.
mount -t cifs -o username=xxxxxx,password=xxxxx,domain=WORKGROUP //192.xxx.yy.z/music /media
In order to mount a folder, it must exist, yes. But you’re mounting to /media, which exists in docker image.
Have a look at comment of @nickcjMount remote smb share on hassio where he says that the command didn’t work from terminal, but actually worked when he used it as shell_command.
Very very veryyy thanks, it works now like a charm!!! All of my music collection i can now browse via mediabrowser…
Another question is how i can play songs after and after. It stops now by me at the end of every track and then i must to browse the next track and hit to play.
I had this error issue when I tried to put that yaml in the wrong place of the config file.
I will take a look tomorrow morning and send you a sample of where I’ve managed to enter that config and get it to pass the config checker.
@denveronly
I ended up having to put my media_dirs config right at the top of my configuration.yaml file for to configuration to be validated. Not sure if its the right place or not, but it’s working for me with no negatives.
If you configure using the Visual Studio Code plugin within HA, then it will still throw up an error with “Property media_dirs is not allowed” however ignore that, i am assuming its a plugin issue. Just hit save and go to your server controls and check config then reboot, everything should work.
Sample of mine below:
# Configure a default setup of Home Assistant (frontend, api, etc)
homeassistant:
media_dirs:
cctv: /mnt/cctv
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
python_script:
system_health:
climate:
well my string is from config.yaml from the very top (second line if to be correct)
it gives an error, and the cause of that is any other folder, or a string mnt
if i restart it, HA goest to safemode with that error
Another approach - install portainer, open shell, create folder.
Yet another approach - do not list anything in media_dirs, but do create shell_command: “mkdir /mnt/media2” - execute it, and then create media_dirs config. But you probably will need to do this after every upgrade.
Hey man, it worked, you are a genius. The error is gone. well i tried before to make a folder using portainer console. but ssh comands worked better
but the thing is that the drive is still not mounting
i wrote this command in configuration.yaml
shell_command:
mount_smbmedia_folder: mount -t cifs -o username=idenya,password=Password,domain=WORKGROUP //192.168.1.210/Public /mnt/media2
It goes to my WD my cloud drive. IP, Login, Password are correct im pretty sure. Folder exists (if it would not exist - the error did not go away)
but it doesnt mount.
If i try to execute Shell command manualy in configurator i get
Command executed: mount -t cifs -o username=idenya,password=Password,domain=WORKGROUP //192.168.1.210/Public /mnt/media2 : 255
mount: mounting //192.168.1.210/Public on /mnt/media2 failed: No such file or directory