Choose style:

Author Topic: How to automount a samba share [SOLVED]  (Read 6968 times)

0 Members and 1 Guest are viewing this topic.

Offline rmcellig

  • Member
  • ***
  • Posts: 205
  • Karma: 13
  • New Forum User
    • View Profile
How to automount a samba share [SOLVED]
« on: April 16, 2014, 05:21:20 pm »
What am I doing wrong? If you require more info, let me know. I'm stumped. :)

For some reason, my fstab entry doesn't work. Here is what it looks like:

Code: [Select]
//192.168.2.15/lps-2000 /media/dv2000/ cifs uid=1000,gid=1000,credentials=/home/randy/Documents/credentials­,iocharset=utf8,sec=ntlm 0 0

Here is the error I am getting:

Code: [Select]
error 2 (No such file or directory) opening credential file /home/randy/Documents/credentials­

My home directory:

Code: [Select]
drwxr-xr-x 5 randy randy 4096 Apr 16 16:53 Desktop
drwxr-xr-x 2 randy randy 4096 Apr 16 16:04 Documents
drwxr-xr-x 3 randy randy 4096 Apr 15 20:36 Downloads
-rw-rw-r-- 1 randy randy  155 Dec 16 06:07 LICENSE.TXT
drwxr-xr-x 5 randy randy 4096 Apr  9 13:36 Music
drwxr-xr-x 2 randy randy 4096 Mar 14 17:41 Pictures
drwxr-xr-x 2 randy randy 4096 Mar 14 17:41 Public
drwxr-xr-x 2 randy randy 4096 Mar 14 17:41 Templates
drwxr-xr-x 2 randy randy 4096 Mar 14 17:41 Videos

My credentials file:

Code: [Select]
-rw------- 1 randy randy    30 Apr 16 13:39 credentials

« Last Edit: April 17, 2014, 06:57:46 am by rmcellig »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25660
  • Karma: 2819
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: How to automount a samba share
« Reply #1 on: April 16, 2014, 08:37:55 pm »
What's the output from:
Code: [Select]
ls -a /home/randy/Documents
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline rmcellig

  • Member
  • ***
  • Posts: 205
  • Karma: 13
  • New Forum User
    • View Profile
Re: How to automount a samba share
« Reply #2 on: April 16, 2014, 08:44:00 pm »
Here you go:

Code: [Select]
randy@mintdv6 ~ $ ls -a /home/randy/Documents
.  ..  candy  credentials  resources  resources.html  reviews-original.html
randy@mintdv6 ~ $

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25660
  • Karma: 2819
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: How to automount a samba share
« Reply #3 on: April 16, 2014, 09:29:40 pm »
OK, to bring it in line with my known working stanza which is VERY similar...

Run:
Code: [Select]
sudo mv -v /home/randy/Documents/credentials /home/randy/.smbcredentials
then
Code: [Select]
sudo chown root:root /home/randy/.smbcredentials
then make your fstab stanza read
Code: [Select]
//192.168.2.15/lps-2000 /media/dv2000 cifs credentials=/home/randy/.smbcredentials,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0



Oddly there seemed to be a weird "-" symbol at the end of your "credentials=/home/randy/Documents/credentials­-"
but it wasn't selectable when editing .. weird  :-\



I think the main problem is you'd chmod(ed) your credentials file to 600 .. which made it only readable by the owner .. yet it needs to be readable by root.

the idea of chmod(ing) it to 600 is for security purposes, so nobody else can read its contents .. but it MUST be owned by root, as fstab is acted upon by root.



I've also removed the trailing / after "dv2000" in the fstab stanza as it's superfluous ;)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline rmcellig

  • Member
  • ***
  • Posts: 205
  • Karma: 13
  • New Forum User
    • View Profile
Re: How to automount a samba share
« Reply #4 on: April 17, 2014, 06:28:42 am »
Thanks so much for your reply!

This is what I am getting:

Code: [Select]
randy@mintdv6 ~ $ sudo mount -a
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

My fstab entry:

Code: [Select]
#mount samba share
//192.168.2.15/lps-2000 /media/dv2000 cifs credentials=/home/randy/.smbcredentials,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0

Offline rmcellig

  • Member
  • ***
  • Posts: 205
  • Karma: 13
  • New Forum User
    • View Profile
Re: How to automount a samba share
« Reply #5 on: April 17, 2014, 06:56:34 am »
It works!!!! I changed the name of my share from  lps-2000 to mylps. I just restarted the computer and everything looks fine. Thanks so much!!

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25660
  • Karma: 2819
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: How to automount a samba share [SOLVED]
« Reply #6 on: April 17, 2014, 07:28:33 am »
You're most welcome .. thanks for marking the topic (SOLVED) :)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline rmcellig

  • Member
  • ***
  • Posts: 205
  • Karma: 13
  • New Forum User
    • View Profile
Re: How to automount a samba share [SOLVED]
« Reply #7 on: April 17, 2014, 07:37:01 am »
I only have one question regarding this. What does this mean in my fstab stanza and do I need it?

Code: [Select]
iocharset=utf8,sec=ntlm

I just modified my fstab file on my Dell 3000 and guess what? It works!! I'm so happy!!! :) :)
« Last Edit: April 17, 2014, 08:10:57 am by rmcellig »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25660
  • Karma: 2819
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: How to automount a samba share [SOLVED]
« Reply #8 on: April 17, 2014, 07:52:22 am »
From the mount.cifs man page:
Code: [Select]
man mount.cifs

Quote
       iocharset
           Charset used to convert local path names to and from Unicode.
           Unicode is used by default for network path names if the server
           supports it. If iocharset is not specified then the nls_default
           specified during the local client kernel build will be used. If
           server does not support Unicode, this parameter is unused.

and

Quote
       sec=
           Security mode. Allowed values are:

           ·   none attempt to connection as a null user (no name)

           ·   krb5 Use Kerberos version 5 authentication

           ·   krb5i Use Kerberos authentication and forcibly enable packet
               signing

           ·   ntlm Use NTLM password hashing (default)

           ·   ntlmi Use NTLM password hashing and force packet signing

           ·   ntlmv2 Use NTLMv2 password hashing

           ·   ntlmv2i Use NTLMv2 password hashing and force packet signing

           ·   ntlmssp Use NTLMv2 password hashing encapsulated in Raw NTLMSSP
               message

           ·   ntlmsspi Use NTLMv2 password hashing encapsulated in Raw
               NTLMSSP message, and force packet signing

           If the server requires signing during protocol negotiation, then it
           may be enabled automatically. Packet signing may also be enabled
           automatically if it's enabled in /proc/fs/cifs/SecurityFlags.

Does that help ?



Your original error was being cause by the "-" in the path to your share .. fstab handles special characters weirdly .. you need to use their octal code (prefixed with an escape character \).

so
//192.168.2.15/lps-2000
would need to be
//192.168.2.15/lps\0552000
as the ascii octal code for "-" is "055"

and
//192.168.2.15/My Documents
needs to be
//192.168.2.15/My\020Documents
as the ascii octal code for SPACE is "020"

For a list of the octal codes:
Code: [Select]
man ascii
Sorry, somehow I missed the hyphen previously  :-[
« Last Edit: April 17, 2014, 08:57:15 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline rmcellig

  • Member
  • ***
  • Posts: 205
  • Karma: 13
  • New Forum User
    • View Profile
Re: How to automount a samba share [SOLVED]
« Reply #9 on: April 17, 2014, 12:30:58 pm »
Actually I think I was at fault because out of habit I avoid dashes and other such characters and just keep everything lowercase and simple. Seems to make Linux life a lot easier!

Thanks for the info on the other two items I mentioned in my previous post.