HDD mounted in SMB asking for password?

Hi everybody

I have installed SMB and mounted a HDD. Using user and password i can enter OSMC folder but i cannot enter in the hdd folder. What to do?

Firstly, have you updated to RC3 ? Because the whole samba and external drive share setup has changed, so if you haven’t I would update first. From RC3 on you should get a separate share automatically created for each partition on externally connected drives.

Second, I’m not sure what you mean by using user and password - the username and password for the samba shares are both ‘osmc’. The share list itself can be accessed with any username/password or guest access however. (Since RC3)

I have updated to RC3 and installed smb server.
HDD appears on Samba. When i try to access it on windows i have to put user and pass, then i can enter the folder OSMC (SD card) but cannot enter HDD because he asks again for credentials (osmc user/pass) do not work (this behavior also happens in rpi when i try to access from kodi menu).

Sorry for my english!

Thanks in advance

I am also having this problem, which is new to RC3.

I have two shares after the upgrade: OSMC, which is the home directory, and Samsung, which is my USB HD.

Prior to upgrading to RC3, I could use osmc/osmc for username / pass and access the samsung drive via the “devices” share. Now it doesn’t work anymore. The OSMC share is accessible, but the Samsung one gives me access denied.

I’ve managed to get around the problem in the short term by adding the old Devices share back in:

File: /etc/samba/smb-shares.conf

[devices]
browsable = yes
read only = no
valid users = osmc
path = /media
force user = root
comment = Deprecated (Please use the Auto-mount Volume shares)
hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

Not sure what this share does differently to the automounted ones, but this lets me access the external drive that just gives me an access denied error with the automount share.

What file system is the external drive formatted as ?

Can you provide the output of

ls -al /media

Drive is ext4:

/dev/sda1 on /media/SAMSUNG type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)

ls -al /media
drwxr-xr-x 3 root root 4096 May 22 20:40 .
drwxr-xr-x 23 root root 4096 Apr 19 00:39 …
-rw-r–r-- 1 root root 232 Mar 6 12:34 README
drwxr-xr-x 5 root root 4096 Mar 1 2014 SAMSUNG

Kind Regards,
Dave

The new per partition samba shares do not have the force user = root option, your ext4 partition is owned by root and is not world writeable which means users other than root can’t write to the root partition of that drive.

The old workaround for this was force user = root for the devices share, however we decided to remove this because it means you are writing files as root using samba which means those same files will not be writable / overwritable by either Kodi or the FTP server.

For better compatibility samba now writes to automount shares as the osmc user so that the files it creates can be written to or deleted by kodi or ftp server.

However this means you will need to chown/chmod the existing content of your external drive. Assuming that the content of the drive is just media files I would do

sudo chown -R osmc:osmc /media/SAMSUNG

This will change ownership of all files and directories on that partition to osmc and you will now be able to write to them with samba via the per partition shares, and you should then stop using the devices share. (As that will still be writing as root)

This issue only crops up with ext4 formatted external drives - for FAT32/EXFAT/NTFS the issue doesn’t occur because all files are always owned by the same user.

I’ve just tried that and then rebooted and alas it hasn’t helped. It has fixed another issue I was having where I couldn’t delete files within Kodi though, which makes sense based on what you said above.

One thing I have just noticed which may or may not be relevant is that the capitalisation of the mount point is different to that of the samba share.

The samba share is lowercase “samsung” according to windows, whereas the mount point is /media/SAMSUNG. Dunno if that would make a difference, but knowing how case mismatches can cause problems between OSs thought I’d mention it.

Can you paste the output of these two commands ?

sudo net usershare info
sudo net usershare list

Don’t worry about the capitalisation of the share names - I have seen both lower case and upper case capitalisation for the same drive depending on how it is mounted and I’m not sure what the cause is - but it doesn’t cause an issue as share names are not case sensitive.

osmc@osmc:~$ sudo net usershare info
[SAMSUNG]
path=/media/SAMSUNG
comment=Auto-mount Volume
usershare_acl=OSMC\(null):F,
guest_ok=n

osmc@osmc:~$ sudo net usershare list
SAMSUNG
osmc@osmc:~$

Ah. I know roughly where the problem is then. This is wrong:

usershare_acl=OSMC\(null):F,

It should look like this:

[Ext4]
path=/media/Ext4
comment=Auto-mount Volume
usershare_acl=RPI2\osmc:F,
guest_ok=n

Notice the ACL for the osmc user. (RPI2\osmc as my hostname is set to RPI2)

Without the correct ACL you won’t have any access to the share.

Can you

sudo journalctl | paste-log

?

Here you go: http://paste.osmc.io/igijotulit

Thanks for the help!

Thanks. Lots of usershare errors there. How about:

sudo ls -al /var/lib/samba/usershares/
osmc@osmc:~$ sudo ls -al /var/lib/samba/usershares/
total 12
drwxrwx--T 2 root sambashare 4096 May 22 23:18 .
drwxr-xr-x 5 root root       4096 May 22 20:32 ..
-rw-r--r-- 1 root root        144 May 22 23:18 samsung
osmc@osmc:~$

Thanks, I’ve found the problem, just trying to work out the best fix. Will let you know when a fix is pushed.

Nice one, thanks!

Remote debugging via the medium of a forum :slight_smile:

The problem is just specifying osmc:f on the command line is ambiguous - my hostname is RPI2 so osmc gets interpreted as the username, however when I change my hostname back to the default osmc I see the same problem as you - presumably it is interpreting the osmc to be the domain name then and is expecting a (non existant) username to follow, because there isn’t one it is (null).

Thanks for the help in spotting this. This should now be fixed by this change:

I’ve pushed the fix out to release as well, please try running updates and then check again and you should find you can access the automount shares using osmc/osmc.

1 Like

Installed updates and rebooted, all working now :sunny:

Thanks for the quick fix, glad to help.

1 Like