What does this line mean?


11 posts
by D.E.L.B. » Fri Jul 06, 2012 4:06 pm
http://www.youtube.com/watch?v=Pn-9FDo_ ... age#t=126s


The thing I don't get is that when he says "if your on Windows, then you'll need to enter the password and username." But how exactly? I tried connecting but I'm not sure what the "guest" has to do with it, perhaps it's my PC username, perhaps not... I'm not sure. I am also not sure what the password for the NAS is, so would it be the administrative username and password I use on my Windows PC, or something else again?

Thanks. I find it hard to explain, I hope you get me.
User avatar
Posts: 92
Joined: Sat Jun 09, 2012 7:16 pm
Location: Wales, UK
by nick.mccloud » Sat Jul 07, 2012 2:14 pm
He's referring to the computer that he is connecting to - so it's likely, as you mention, that it will be your PC's username and password.

In the video he says that his computer is setup with guest access so he just uses that. It's more usual to connect with your username (login) and password for the device you are connecting to.
User avatar
Posts: 795
Joined: Sat Feb 04, 2012 4:18 pm
by D.E.L.B. » Sat Jul 07, 2012 2:35 pm
nick.mccloud wrote:He's referring to the computer that he is connecting to - so it's likely, as you mention, that it will be your PC's username and password.

In the video he says that his computer is setup with guest access so he just uses that. It's more usual to connect with your username (login) and password for the device you are connecting to.

So do I wright instead of "guest" my computer's name and password? I tried that but it didn't work.
User avatar
Posts: 92
Joined: Sat Jun 09, 2012 7:16 pm
Location: Wales, UK
by odelcarmen » Sat Jul 07, 2012 3:36 pm
D.E.L.B. wrote:http://www.youtube.com/watch?v=Pn-9FDo_J3M&feature=player_detailpage#t=126s


The thing I don't get is that when he says "if your on Windows, then you'll need to enter the password and username." But how exactly? I tried connecting but I'm not sure what the "guest" has to do with it, perhaps it's my PC username, perhaps not... I'm not sure. I am also not sure what the password for the NAS is, so would it be the administrative username and password I use on my Windows PC, or something else again?

Thanks. I find it hard to explain, I hope you get me.



I believe he is referring to an existing RPi user not Windows'. He had installed/enabled his samba service, so that network user (windows users) can access it as well. Default login/password for Debian is pi/raspberry.
Posts: 10
Joined: Sat Jul 07, 2012 12:41 pm
by D.E.L.B. » Sat Jul 07, 2012 9:12 pm
odelcarmen wrote:
D.E.L.B. wrote:http://www.youtube.com/watch?v=Pn-9FDo_J3M&feature=player_detailpage#t=126s


The thing I don't get is that when he says "if your on Windows, then you'll need to enter the password and username." But how exactly? I tried connecting but I'm not sure what the "guest" has to do with it, perhaps it's my PC username, perhaps not... I'm not sure. I am also not sure what the password for the NAS is, so would it be the administrative username and password I use on my Windows PC, or something else again?

Thanks. I find it hard to explain, I hope you get me.



I believe he is referring to an existing RPi user not Windows'. He had installed/enabled his samba service, so that network user (windows users) can access it as well. Default login/password for Debian is pi/raspberry.

I have never heard of Samba, so what does that do?
User avatar
Posts: 92
Joined: Sat Jun 09, 2012 7:16 pm
Location: Wales, UK
by Joe Schmoe » Sat Jul 07, 2012 9:19 pm
D.E.L.B. wrote:I have never heard of Samba, so what does that do?


It is a dance in which two people's belly buttons touch.
Like so much of Linux these days, the attempts to make it suitable for
dumb idiots are making it much harder for someone who wants to do
something the designers never anticipated.
Posts: 2930
Joined: Sun Jan 15, 2012 1:11 pm
by D.E.L.B. » Sat Jul 07, 2012 9:23 pm
Joe Schmoe wrote:
D.E.L.B. wrote:I have never heard of Samba, so what does that do?


It is a dance in which two people's belly buttons touch.

Fair dues hahahaha.

But... :P.
User avatar
Posts: 92
Joined: Sat Jun 09, 2012 7:16 pm
Location: Wales, UK
by JeremyF » Sat Jul 07, 2012 9:33 pm
D.E.L.B. wrote:
Joe Schmoe wrote:
D.E.L.B. wrote:I have never heard of Samba, so what does that do?


It is a dance in which two people's belly buttons touch.

Fair dues hahahaha.

But... :P.

A standard sharing protocol. Have you ever made your Windows PC accessible over a local network? That is Samba. And it is Mac and Linux compatible as well.
{sig} Setup: Original version Raspberry Pi (B, rev1, 256MB), Dell 2001FP monitor (1600x1200), 8GB Class 4 SD Card with Raspbian and XBMC, DD-WRT wireless bridge
Posts: 516
Joined: Wed Jan 25, 2012 9:06 pm
by D.E.L.B. » Sat Jul 07, 2012 9:46 pm
Will look into it.

Cheers.
User avatar
Posts: 92
Joined: Sat Jun 09, 2012 7:16 pm
Location: Wales, UK
by rurwin » Sat Jul 07, 2012 11:30 pm
When it tries to mount the remote directory, the RaspPi has to effectively log in to the remote machine. You don't want just anyone accessing your files do you? So to do that it needs to give the remote machine a username and a password. The video shows how to connect to an NAS device (a Network-Attached Storage device) not a Windows PC. That NAS device has been configured not to require a username and password (I guess he doesn't care who accesses his files.) But you will have to give a username and password that the Windows PC will accept. So yes, it's a Windows log-in that you are looking for, but that's only the first problem; now you have to find out how to do that.

If we look at "man mount" the first thing we find is that it is massive. If the information we need is in there then we are going to need some help finding it or a few days to tease it out. However going back to the video we see that the important parameter "guest" is introduced with the switch "-o". So we can fast forward the man mount command to that switch, and we read:
-o, --options opts
Options are specified with a -o flag followed by a comma sepa‐
rated string of options. For example:

mount LABEL=mydisk -o noatime,nouser

For more details, see FILESYSTEM INDEPENDENT MOUNT OPTIONS and
FILESYSTEM SPECIFIC MOUNT OPTIONS sections.

Now we know that we are looking for "options" and we know where to look. Unfortunately the options we are looking for are not in the FILESYSTEM INDEPENDENT MOUNT OPTIONS, so we need to look for the FILESYSTEM SPECIFIC MOUNT OPTIONS, and for that we need to know the filesystem type. If we look back at the video we see that the first parameter is "-t cifs", and sure enough, "man mount" says:
-t, --types vfstype
The argument following the -t is used to indicate the filesystem
type.

That makes sense because CIFS is the network protocol for Microsoft file-sharing and since Windows understands nothing else it is widely used for other devices too. See Wikipedia for far too much background information, including the relationship to "Samba". Armed with this new information we go back to "man mount" and look excitedly for the "FILESYSTEM SPECIFIC OPTIONS" section. We browse down there past adfs and affs, both of which have all their options listed. However when we get to cifs, it directs us to the manual page for "mount.cifs". So to find out how to specify the username and password, you have to look at "man mount.cifs", and that says (in part):

user=arg
specifies the username to connect as. If this is not given, then
the environment variable USER is used. This option can also take
the form "user%password" or "workgroup/user" or
"workgroup/user%password" to allow the password and workgroup to be
specified as part of the username.

Note
The cifs vfs accepts the parameter user=, or for users familiar
with smbfs it accepts the longer form of the parameter
username=. Similarly the longer smbfs style parameter names may
be accepted as synonyms for the shorter cifs parameters
pass=,dom= and cred=.

password=arg
specifies the CIFS password. If this option is not given then the
environment variable PASSWD is used. If the password is not
specified directly or indirectly via an argument to mount,
mount.cifs will prompt for a password, unless the guest option is
specified.

Note that a password which contains the delimiter character (i.e. a
comma ´,´) will fail to be parsed correctly on the command line.
However, the same password defined in the PASSWD environment
variable or via a credentials file (see below) or entered at the
password prompt will be read correctly.

guest
don´t prompt for a password

We see that the video used the "guest" option, whereas if there is a username and password required we would have to use the "user=" and probably the "password=" options. If we go back to "man mount" we can see right at the top of the page how to specify multiple options:

mount [-fnrsvw] [-o option[,option]...] device|dir

Multiple options are specified separated by commas with no spaces.

Lets say our Windows username was USER and its password was PASSWORD, its IP address was 192.168.0.2 and the folder we wanted to share was called "media", then we can use the same command that the video used, but replace the guest option with two options specifying the username and password that we need to use:

sudo mount -t cifs -o user=USER,password=PASSWORD //192.168.0.2/media /mnt/nomnom


Phew! The information is there, but it took some finding! Thankfully that is about as difficult as it gets.
User avatar
Forum Moderator
Forum Moderator
Posts: 2949
Joined: Mon Jan 09, 2012 3:16 pm
by D.E.L.B. » Mon Jul 09, 2012 10:49 pm
Brilliant.

Everything seems to work now, and thanks rurwin a lot! A very informative and detailed post on how you found it all out.
User avatar
Posts: 92
Joined: Sat Jun 09, 2012 7:16 pm
Location: Wales, UK