nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

connection to a windows shared folder.

Sun Nov 08, 2015 4:49 pm

Hi everyone,

I want to get to the files on my media server computer. While there are several write up like this one
http://www.stuffaboutcode.com/2012/05/r ... share.html

I am stuck with my Pi telling me

[email protected] ~ $ sudo mount -a
Unable to find suitable address.

This is what I have added as the first line to /etc/fstab

Code: Select all

//192.168.1.170/Series /home/pi/titanserver cifs username=****,password=****,workgroup=WORKGROUP,users,auto,user_xattr 0 0
My username is that name I use in windows to long on to the server and the password is the password that I use to log on to the windows server.
The shared folder is called Series and the permissions are set to Everyone full control, change, read in windows.

Currently I am on a Pi 2 running
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie

I can ping 192.168.1.170 and I see a network computer called Raspberry Pi under the windows network tab of file explorer.

I am not sure where to go next to trouble shoot this problem. All help is appreciated.

Thanks!

beta-tester
Posts: 1304
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connection to a windows shared folder.

Sun Nov 08, 2015 5:36 pm

on windows, if you open the command line on windows and type in

Code: Select all

net share
is there your shared folder in the list (in the first column) and is it written like that, you use in your fstab?
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 5:40 pm

Here is what I get. So I think yes? The first column lists share names and one of them is Series but under the remark it does not say Default Share. It does list D$ that has the resource of D:\ and Series also has this. So can you tell me a little more about how it should be written in /etc/fstab? I included what I wrote in my first post for other to see.

Thanks
Attachments
netshare.JPG
netshare.JPG (42.21 KiB) Viewed 32345 times

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: connection to a windows shared folder.

Sun Nov 08, 2015 6:03 pm

That looks OK, what is in the "Remarks" column isn't important.

From the RPi command line try this, use your Windows username, and see if it asks for a password, or if you get an I/O error.

Code: Select all

sudo mount //192.168.1.170/Series /home/pi/titanserver -t cifs -o username=yourusername
Which version of Windows are you using?

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 6:05 pm

8.1 Pro.
The command you gave me produces the following

Code: Select all

[email protected] /etc $ sudo mount //192.168.1.170/Series /home/pi/titanserver -t cifs -o username=Kira
Password for [email protected]//192.168.1.170/Series:  ****
Unable to find suitable address.

beta-tester
Posts: 1304
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connection to a windows shared folder.

Sun Nov 08, 2015 6:09 pm

all the shares you see with the $ at the end are hidden shares and were normally created from windows by default. (hidden, because they will be not visible in the list if you look for available shares on your computer from an other computer. but you can connect to that shares - but these created shares need normally administrator privileges to be able connect)
you can share drives and folders as many as you want, even if they are the same... only the share name must be different. and you can give each share different access permissions.
so, that shouldn't be the problem.

but possibly that you shared the root of the drive ( D:\ ) and not a folder can be an issue, if D:\ has limited access privileges to the user, you selected in the share.
if the filesystem provileges only allow administrators and local users access, and you gave "all"/everyone full access to the share, that can be possibly problematic.

try to put your user (i think it is Kira) or users (Local users/local accounts) to the share instead of everyone

EDIT: sorry, i am sitting on a non-english language PC at the moment, so i can not tell you the exact spelling.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 6:28 pm

Funny you has mentioned this as I just did this 5 minutes before. I have not restarted anything but I get the same issue with the local user added to the drive root. This drive is a windows dynamic drive FYI. When I try to share a sub folder windows knows that it is already shared given it is a subfolder of the root drive which was shared.

I selected a subfolder (Titanserver/Series/1.Current) to the drive and changed the shares to include everyone. It will not let me add the user Kira as this user is the owner of the folder. It is listed under the Network tab in windows under Titianserver/1.Current

Code: Select all

sudo mount //192.168.1.170/1.Currrent /home/pi/titanserver -t cifs -o username=yourusername
Getting it asking for a password, but when I type in the password I get the same answer - Unable to find suitable address. :(
Attachments
Security.PNG
Security.PNG (8.95 KiB) Viewed 32222 times

beta-tester
Posts: 1304
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connection to a windows shared folder.

Sun Nov 08, 2015 6:45 pm

ok, i tried it with the windows GUI with no success. :shock:
but i was able to do a working share by using the command console.

on windows site, i was creating a user with password (in case your normal user is not having a password)

Code: Select all

net user myUserName myPassword /ADD
creating a share

Code: Select all

net share myShareName=D:\ /GRANT:myUserName,FULL
and on my RPi i was using

Code: Select all

sudo mount -t cifs //xxx.xxx.xxx.xxx/myShareName /mnt/ -o username=myUserName,password=myPassword
(where xxx.xxx.xxx.xxx the IP of my windows PC is) it is anequivalent to your fstab entry... yours looked ok to me.

PS: only passwords up to 15 characters are allowed. and by default windows does not allow incomming connecting to shares if the user does not have a password

PPS.: if you still are not able to connect,
then take a look to the logs "sudo journalctl" (on jessie)
or then install and try the smbclient to connect to windows share. is is givin a bit more detailed error message than the mount command.
Last edited by beta-tester on Sun Nov 08, 2015 6:59 pm, edited 1 time in total.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 6:54 pm

RIGHT THE F*%$ ON! :D

So it told me that the user already existed but I created a share to the d:\ like you said and now I can get to the files on my server from my PI.

So I guess the GUI isn't as powerful as the command line. A good lesson for me to remember.

Thanks for the help

P.S. Any idea why it wasn't working before?
P.S.S. I just took a look at the permissions of the newly created share and it lists users Everyone AND Administrators. The old shares only listed Everyone. The user Kira is an administrator.
P.S.S.S Sorry that isn't correct the share only has the user Kira and Everyone.

beta-tester
Posts: 1304
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:04 pm

ya, the GUI is a bit strange, because there are two versions of sharing...
a light shareing version and an extendend shareing version you can choose in the file browser options.
even then i always get in trouble.
i always only trust the command comsole... ;)

PS.: use net share myShareName /DELETE, to delete the share

PPS.: the step with creating an user is only if the user in not existing already, to give more control, who is allowed to use the share.
WARNING - SECURITY ISSUE
creating an additional user via net user ... creates an additional interactive user account on the local windows computer that can be used to log on to that machine.
if you want to create an non-interactive user for having more control over remote connected user, then you should use lusrmgr.msc, to create an non-interactive user
Last edited by beta-tester on Sun Nov 08, 2015 7:53 pm, edited 2 times in total.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:13 pm

Again thanks for the selfless help. Have a Great Day.

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:21 pm

I thought I was done asking questions but now I want to edit my fstab file to mount at startup. Do I use

Code: Select all

sudo mount -t cifs //192.168.1.170/Series /mnt/ -o username=Kira,password=****
or

Code: Select all

//192.168.1.170/Series /home/pi/titanserver cifs username=Kira,password=****,workgroup=WORKGROUP,users,auto,user_xattr 0 0

beta-tester
Posts: 1304
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:28 pm

nzdreamer55 wrote:I thought I was done asking questions but now I want to edit my fstab file to mount at startup. Do I use

Code: Select all

sudo mount -t cifs //192.168.1.170/Series /mnt/ -o username=Kira,password=****
or

Code: Select all

//192.168.1.170/Series /home/pi/titanserver cifs username=Kira,password=****,workgroup=WORKGROUP,users,auto,user_xattr 0 0
use the last one for /etc/fstab
the first one is only (but always working), if you type in the command in the terminal window, in case, you want to connect on "demand" and there is no entry in the fstab
if you have the entry in the fstab, and want to connect on demand,
then you need simply sudo mount /home/pi/titanserver
or more shorter sudo mount -a to mount everything that is listed in the fstab
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:51 pm

Sweet. Thanks

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:55 pm

Since it's a cifs mount you'll need to specify a userid or it will belong to root. The credentials are to connect to Windows, the userid is to specify the ownership of the mounted files.

I use a separate credentials file, so I don't have to put login info in fstab.

My fstab lines to mount Windows shares using Jessie look like

Code: Select all

//192.168.0.3/Downloads /home/pi/win7-folder cifs credentials=/home/pi/.smbcredentials,uid=pi,gid=pi,noauto,x-systemd.automount 0 0
That's all one line of course, no line breaks

My credentials file is named ".smbcredentials" and it's located in ~/ You can name it anything you like, and put it anywhere, just so the path/name are correct in fstab. The file contains.

Code: Select all

username=<windowsusername>
password=<windowspassword>
domain=<yourworkgroupname>

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Sun Nov 08, 2015 7:58 pm

OK now that is is getting Fancy! I like it. Will post back if I have trouble. Thanks

beta-tester
Posts: 1304
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: connection to a windows shared folder.

Sun Nov 08, 2015 8:06 pm

JimmyN wrote:Since it's a cifs mount you'll need to specify a userid or it will belong to root. The credentials are to connect to Windows, the userid is to specify the ownership of the mounted files.
I use a separate credentials file, so I don't have to put login info in fstab.
oh yes, a very good addition

Code: Select all

credentials=...,uid=pi,gid=pi
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: connection to a windows shared folder.

Mon Nov 09, 2015 11:51 am

You can also access a Windows share without using the command line at all, only the GUI. You won't need to create a mount point or mount any shares you can let FileManager handle everything.

First share a folder on Windows, or use an existing share.

Some of these steps may take a bit on the first access, as discovery must be done, so give it a little time.

On the RPi open Filemanager, and up in the menu bar click on "Go", then "Network".
You'll see the "Windows Network" listed, double click on that.
Next you'll see the workgroup listed, double click on that.
Now you'll see the PC or PC's in that workgroup, double click on the PC you want.
It will ask for your Windows username and password. You can choose to have it remember the password or not.
Next you'll see a list of all the shared folders on that PC, double click on the one you want.
It will again ask for your username and password.
Now that the shared folder is open click on "Bookmarks" in the menu bar and add it as a Bookmark.

In the future you can open Filemanager, then use "Bookmarks" to jump right to the shared folder. It works well for shares that you only want to access occasionally, and don't want to go through the process of setting it up to mount every time the RPi boots.

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Wed Nov 18, 2015 7:27 pm

Well the fun seems to have stopped. While I can ls the shares, I cannot modify the files or folders on the shares unless I sudo the command.

I was using lftp to d/l files to a share but it will always fail unless the terminal window is set to root (sudo -i).

Is the problem that my windows machine uses a different user than my pi machine? I figured that if could mount the share with the correct user name and password then I could do everything on the share (write, delete, move, etc.) that the user who was logged in could do.

Why do I need to sudo everything?

I tried to change my fstab for the share but still need to sudo everything

Code: Select all

//192.168.1.180/Toshiba.Scratch /home/pi/Scratch cifs username=Kira,password=***********,workgroup=WORKGROUP,users,auto,dir_mode=0777,file_mode=0666,user_xattr 0 0

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: connection to a windows shared folder.

Wed Nov 18, 2015 8:51 pm

The username and password you're providing are to access the Windows share, on the Windows system. That has nothing to do with who owns the share when it's mounted on the RPi. Since you're not providing any ownership information in the fstab line when you mount it the share belongs to root, that's why you have to use sudo. Look back over the previous posts.

You can use masks or other means, but the easiest is just to include "uid=pi,gid=pi" to the mount command if you want the share to belong to "pi" and have read/write access.

Try this line

Code: Select all

//192.168.1.180/Toshiba.Scratch /home/pi/Scratch cifs username=Kira,password=***********,workgroup=WORKGROUP,uid=pi,gid=pi,noauto,x-systemd.automount 0 0

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Wed Nov 18, 2015 9:18 pm

Thanks. That makes sense.

nzdreamer55
Posts: 29
Joined: Wed Nov 04, 2015 12:56 am

Re: connection to a windows shared folder.

Wed Nov 18, 2015 11:54 pm

Could you tell me a little bit about what the end of this line is doing?

Code: Select all

noauto,x-systemd.automount 0 0
I have looked at some of the man pages but they are a little too cryptic for me.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: connection to a windows shared folder.

Thu Nov 19, 2015 11:33 am

I used those parameters since it's a network share. When fstab runs and tries to mount the Windows share the network may not be up yet, so the mount can fail. To prevent that the "noauto" tells it not to automatically mount it at boot time, as it normally would, and "x-systemd.automount" will hand it off to systemd which will wait and mount it at the first access. By that time the network will be up and the share will be mounted automatically on your first access to it.

The "0 0" on the end is to set the file system check (fsck) values. You don't use that when mounting a share from the commandline, it's only needed in fstab.

It can be a bit confusing as the mount command can vary according to what kind of filesystem you're mounting, and whether it's local or a network share. So the mount command to mount a USB Flashdrive with an ext4 filesystem will be different from mounting a network Windows share. And if you're mounting it from the commandline the command will be slightly different from what you'd use in fstab.

Return to “Beginners”