And Again... can't access to my SMB Windows 10 Shared

Yes only when you try to access it and the server is not available

1 Like

@bmillham and @fzinken thanks to both friends.
Very great info…

If i want to try to pass to this solution you can suggest some other forum thread how i can found some info how all it’s need to configure ?
Thanks in advance.

Didn’t I already posted that?

1 Like

ops… i have made some test following the first reply here:

I have installed autofs by ssh.
Add the line to etc/auto.master
on etc/auto.smb.shares:
/mnt/192.168.1.2/ -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.2/

and i have add the credentials on .smbcredentials files.
After that i have launch:

sudo systemctl restart autofs

But i obtain an errors when i try to mount:

ls -lah /mnt/192.168.1.2/

I have tryed also to follow the debug whitout understand how i commit an errors. the question it’s:
It’s need to remove the previous smb shared before ?

It was a long time ago that I did this, so I might not be remembering correctly, but I think that, when I set up autofs on an SMB share, I couldn’t get it to work using a separate credentials file, but I did make it work by storing username and password within the lines in the auto.smb.shares file.

It’s not all that insecure if you create a special user on the server with limited access rights.

Yeah exactly… i have need to use this:
/mnt/File\ Condivisi/ -fstype=cifs,rw,username=osmc,password=osmc,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.2/File\ Condivisi

Now it’s works…

And another question… i have also right now can remove the smb share currently setted ?
Little question… on /mnt/ i have some other mount point not works problably add here from previous test.
I have “192.168.1.2” and another… how i can remove this two voices ?
It’s removed when i reboot my Pi2 ?

And the last question
Now the /mnt works… but on kodi apparently i can see this newest “mount” point.
It’s not listed at all but it’s correctly mounted… how i can found it ?
It’s not listed on “Source” selection… it’s not listed on “Install from zip files” how it’ works ?
I have also reboot my Pi2 but apprently there’s no listed at all…

EDIT… problably final edit
And it’s apparently also found how it’s works.
I have right now removed all smb share from “File” browser and also from all sources files.
How it’s necessary i have add a source to reach “/” (root of filesystem) and after another source to reach “/mnt/File Condivisi”.

Apparently all it’s works…

Ok, so I take it now everything works?

Assuming nothing is mounted to them and they are empty you can use sudo rmdir <foldername>

It’s strange that the file with the credentials didn’t work. One person mentioned that there might be problems with the permission on the file. Can you show the ls -lah for your home folder?

yes… i can do it:

    root@osmc:~# cd /home
    root@osmc:/home# ls -lah
    totale 12K
    drwxr-xr-x  3 root root 4,0K gen  1  1970 .
    drwxr-xr-x 23 root root 4,0K mag 11  2018 ..
    drwxr-xr-x  9 osmc osmc 4,0K gen 30 17:10 osmc
    root@osmc:/home# cd osmc
    root@osmc:/home/osmc# ls -lah
    totale 76K
    drwxr-xr-x  9 osmc osmc 4,0K gen 30 17:10 .
    drwxr-xr-x  3 root root 4,0K gen  1  1970 ..
    -rw-r--r--  1 root root  315 feb 15  2017 .bash_aliases
    -rw-------  1 osmc osmc  12K gen 12  2018 .bash_history
    -rw-r--r--  1 osmc osmc  220 nov 13  2014 .bash_logout
    -rw-r--r--  1 osmc osmc 3,5K feb 13  2017 .bashrc
    drwxr-xr-x  3 osmc osmc 4,0K mag 10  2015 .cache
    drwxr-xr-x 11 osmc osmc 4,0K ott 16  2018 .kodi
    drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Movies
    drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Music
    drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Pictures
    -rw-r--r--  1 osmc osmc  675 nov 13  2014 .profile
    drwxr-xr-x  2 osmc osmc 4,0K mag  6  2016 .smb
    -rw-r--r--  1 root root   28 gen 30 17:09 .smbcredentials
    -rw-r--r--  1 osmc osmc 7,1K set 26  2018 .swfinfo
    drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 TV Shows
    root@osmc:/home/osmc#

And yes… i use ssh logged as root because. Look infact the permession of .smbcrediatials it’s say “root root”. Autofs as been run as osmc users ?

Well generally I would not recommend to login in as root as it complicates things unnecessary.
And using sudo for the times you need it works better.

I only can say on my system it works with owner osmc:osmc and permission rw-------
As follows:
-rw------- 1 osmc osmc 39 Aug 14 2018 .server.smb

Maybe you want try again using this setting.

yes i know… i remember in pass i need to access as “root” for obtain an access to some files but i don’t remember exactly because so much time it’s pass :slight_smile:
I remember at this time i have also setup the ftp to use “root” user also for access and modify some files…

I see i can change the attributes but how i can change the owner of files in debian ? I need to investigate about this :slight_smile:
On windows 7 (on windows 10 sometime it’s not enough( for example you can set the owner as “Everyone” and give full access to all… i need to investigate if on debian there’s some similar way.

Problably i can simply change attributes to 775 or 777 to obtain all user can access to this files…

Otherwise it’s also works directly put credentials on “auto.smb.shares”… it’s better than nothings :slight_smile:

To change the owner on a file (in your case sudo as needed since it’s owned by root):

sudo chown osmc:osmc ~/.smbcredentials

And to change the permissions (after changing the owner):

chmod 600 ~/.smbcredentials

or if you prefer a slightly more human readable version:

chmod u=rw,g=,o= ~/.smbcredentials

oh ok… i have to found, problably, all find on my system have owner as root:root and if necessary revert to, problably, default osmc:osmc.

Otherwise i have to open another thread to a totally different issue… i begin to thinks my hardware it’s near at end of his life :frowning:

Well that is only for /home/osmc valid. Other locations/files surely have root/root as owner!!!

ops ok… this time i choose to operate as “osmc” users… this is the situation before change owner:

osmc@osmc:~$ cd /
osmc@osmc:/$ cd /home/osmc
osmc@osmc:~$ ls -lah
totale 76K
drwxr-xr-x  9 osmc osmc 4,0K gen 30 17:10 .
drwxr-xr-x  3 root root 4,0K gen  1  1970 ..
-rw-r--r--  1 root root  315 feb 15  2017 .bash_aliases
-rw-------  1 osmc osmc  12K gen 12  2018 .bash_history
-rw-r--r--  1 osmc osmc  220 nov 13  2014 .bash_logout
-rw-r--r--  1 osmc osmc 3,5K feb 13  2017 .bashrc
drwxr-xr-x  3 osmc osmc 4,0K mag 10  2015 .cache
drwxr-xr-x 11 osmc osmc 4,0K ott 16  2018 .kodi
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Movies
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Music
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Pictures
-rw-r--r--  1 osmc osmc  675 nov 13  2014 .profile
drwxr-xr-x  2 osmc osmc 4,0K mag  6  2016 .smb
-rwxr-xr-x  1 root root   28 gen 30 17:09 .smbcredentials
-rw-r--r--  1 osmc osmc 7,1K set 26  2018 .swfinfo
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 TV Shows
osmc@osmc:~$

Wait the result in some minutes…

First Edit
Ok… this is the result now on /home/osmc:

drwxr-xr-x  9 osmc osmc 4,0K gen 30 17:10 .
drwxr-xr-x  3 root root 4,0K gen  1  1970 ..
-rw-r--r--  1 osmc osmc  315 feb 15  2017 .bash_aliases
-rw-------  1 osmc osmc  12K gen 12  2018 .bash_history
-rw-r--r--  1 osmc osmc  220 nov 13  2014 .bash_logout
-rw-r--r--  1 osmc osmc 3,5K feb 13  2017 .bashrc
drwxr-xr-x  3 osmc osmc 4,0K mag 10  2015 .cache
drwxr-xr-x 11 osmc osmc 4,0K ott 16  2018 .kodi
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Movies
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Music
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 Pictures
-rw-r--r--  1 osmc osmc  675 nov 13  2014 .profile
drwxr-xr-x  2 osmc osmc 4,0K mag  6  2016 .smb
-rwxr-xr-x  1 osmc osmc   28 gen 30 17:09 .smbcredentials
-rw-r--r--  1 osmc osmc 7,1K set 26  2018 .swfinfo
drwxr-xr-x  2 osmc osmc 4,0K mar 15  2015 TV Shows
osmc@osmc:~$

When i have 5 minutes i thinks i can retry to use the external credentials…
You can say to me if i can “comment out” the current line working on “auto.smb.shares” ?

You didn’t do the chmod command to fix permissions. You only changed ownership.

First as @bmillham wrote you need to correct the permissions chmod 600 ~/.smbcredentials

Yes easiest is top copy/paste current line and just comment it out and modify the second line

@fzinken and @bmillham
Yes i know i’m not change permission… i leave out 755 to auto.smb.shares. it’s 755>600 and problably it’s works anyway. If not in a instant i can change it…

You can say how i can comment ? Like an xml files ?

With #

Yeah i tryed immediatelly… wait a feedback in a moment. Time to run a ssh shell… stop autofs… modify the correct files and restart autofs :slight_smile:

First Edit
This is my “new” auto.smb.shares files:

# /mnt/File\ Condivisi/ -fstype=cifs,rw,username=osmc,password=osmc,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.2/File\ Condivisi
/mnt/File\ Condivisi/ -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc,vers=3.0 ://192.168.1.2/File\ Condivisi

Test if it’s works…

Second Edit
No… no Luck… it’s not works.
Try to change permission to credentials files…

3rd Edit
No friends… it’s not works.
I have also tryed whit permission set as 600 for credentials files and it’s not works.
Mount it’s be failed…

Whats the content of the file .smbcredentials?
Is it:

username=osmc
password=osmc

With each one line?