Map to SMB shares w/credentials?

Feel free to talk about anything and everything in this board.
Post Reply
RKM
Jr. Member
Jr. Member
Posts: 68
Joined: January 31st, 2010, 4:33 pm

Map to SMB shares w/credentials?

Post by RKM »

I'm running XBMC (first with SABnzbd+ 4.112 then upgraded to 5.0RC3) - being that it's on my XBMC machine, I'd like the paths to save completed files on a remote SMB share.

I've searched this forum on how to do that, and I see several posts talking about using variants of smb://hostname/sharename/path

However, that doesn't pass any user/authentication credentials.

XBMC handles this in the following method: smb://username:password@hostname/sharename/path

Obviously this isn't valid in SABnzb, but I was wondering how I go about the same technique -- that is, specifying a remote path, and how (even if its in a config file somewhere) I go about specifying the credentials required by the SMB share to access it.

Thank you in advance,
RKM
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Map to SMB shares w/credentials?

Post by shypike »

Aren't you supposed to mount external shares first?
RKM
Jr. Member
Jr. Member
Posts: 68
Joined: January 31st, 2010, 4:33 pm

Re: Map to SMB shares w/credentials?

Post by RKM »

In XBMC, you just provide those parameters and evidently it mounts them for you.

I hoped there might be a similar method in SABnzbd+.  In past posts it appeared people were doing something similar; however, I couldn't get that to work either.

If there is currently a way to do this, I'd love to hear more about it.

However, after spending about an hour trying every possibly permeatation, searching the 'net, etc..  I realized that I should try to map the shares at boot.  Not being a Linux guy this was "easier said than done".  Particularly because the method in newer versions of SAMBA is quite a bit different than in older versions, and I stumbled many times before succeeding.

I posted a tutorial based on my experiences for others over at XBMC.  This is a copy of that post:

Mounting an SMB / CIFS share automatically at boot (persistently) in XBMC (helpful for using SABnzbd on XBMC):
Note: I'm a Linux newbie - there may be a better way of doing this; however, this is the working approach I've found after a lot of reading

First, I prefer to login as root, to make it all easer:

Code: Select all

su
Create the directory where you'd like the mount-point. For example

Code: Select all

mkdir /home/xbmc/win-disk
Next, I edited the fstab file:

Code: Select all

nano /etc/fstab
Inside the fstab file, add a mount at the bottom:

Code: Select all

//server_name_or_ip/sharename /mount_point cifs noauto,username=user,password=pass,file_mode=0777, dir_mode=0777 0 0
IMPORTANT: You must substitute your own info here, don't cut-and-paste that line. To be clear, that is:

1) the server name (IP is probably more reliable, use that if you can)
2) the share name
3) a mount point, for example: "/home/xbmc/win-disk"
4) cifs (the file system "smbfs" is depricated, you must use "cifs")
5) the keyword "noauto" which tells it not to mount at boot (we'll mount at login, to avoid problems with mounting a remote share at boot)
6) the username / password of the SMB (Windows) share
7) the permissions (file_mode / disk_mode are the new/updated commands)
8) two zeros, that is "0 0" at the end

Once you've got your fstab file modified, we just have to modify the rc.local file:

Code: Select all

nano /etc/rc.local
Add the following line:

Code: Select all

mount /mount_point
(where "/mount-point" is your actual mount-point (in this example, I used "/home/xbmc/win_disk")

Once you're done, give the system a reboot (I don't know if it's correct, but I just use the "reboot" command at the prompt) then see if you can get a directory of your new mount point. For example: ls /home/xbmc/win-disk

Also, the best article I've found for this is:
https://wiki.ubuntu.com/MountWindowsSharesPermanently

Good luck to anyone else interested in giving this a shot (just don't write me for help, I'm no Linux expert!)
Last edited by RKM on February 1st, 2010, 1:43 pm, edited 1 time in total.
Post Reply