We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Ubuntu - Permanently mount Windows Network Share

Medium Priority
1,614 Views
Last Modified: 2012-05-11
I have a 10.04 LAMP server that's serving a couple sites, sendmail etc. We're on a mostly Windows Network (except a few 10.04 VM hosts) it's a 2k3 domain.
Our backup software does support Ubuntu, but it's GUI and I prefer to keep the Ubuntu servers command line (where possible). I need to backup the above LAMP server (/var/www, the databases, and the storage directory for Drupal) to a shared folder on a Server 2k3 box and have the backup routine grab it from there. The problem is I can't succesfully mount that folder, even just for the existing session, much less permanently mount it.
I've been through countless posts and tried many different methods to mount the share but always end up with the same errors.

1. I have created the credentials file at /root/.smb_credentials:

user=MYDOMAIN\administrator
password=!mypass

(with the extra line at the bottom)

2. I created a mount point at /mnt/oa_bax
3. I created a shared folder on the 2k3 box (administrator by default has full control)
4. I originally tried to add entry in fstab to connect at boot time, but mount -a would throw permissions errors everytime. So I thought it better to just try from the command line to 'temporarily' mount the share then sort out the fstab entry. Like I said I've read probably 30 posts all with slightly varying info on mounting a Windows share and none seem to work:

smbmount //192.168.1.25/oa_backup /mnt/oa_bax/ -o credentials=/root/.smb_credentials,uid=1000,umask=000,domain=MYDOMAIN user   0 0
this throws: mount error(13): Permission denied

smbmount //192.168.1.25/oa_backup /mnt/oa_bax/ -o credentials=/root/.smb_credentials,uid=1000,umask=000,user   0 0
this throws: mount error(13): Permission denied

That's the error displayed in webmin. At the terminal itself, the following is displayed when that command is run from webmin:

CIFS VFS: Send error in SessSetup = -13
CIFS VFS: cifs_mount failed w/return code = -13

I don't know what else to do at this point.


 
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
mount -t cifs //192.168.1.25/oa_backup -o username=administrator,password=!mypass /mnt/oa_bax

didn't work but,

mount -t cifs //192.168.1.25/oa_backup -o username=administrator,password=!mypass,domain=MYDOMAIN /mnt/oa_bax

worked swimmingly. commiting that to memory.

OK so I have that mounted, sweet. So what would the fstab entry be to make it auto mount at boot time?
Preferably I'd like to use a credentials file so as not to store the login info in fstab in plain text. I have a credentials file located at /root/.smb_credentials with the syntax:

user=MYDOMAIN\administrator
password=!mypass

I've read conflicting posts, some say the correct syntax for this is user= others say username= for domains I've read both user(username)=DOMAIN\username and user(username)=DOMAIN/username

However by the looks of your command above that works, with the added domain parameter wouldn't the credentials file look like this:

username=administrator
password=!mypass
domain=MYDOMAIN
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
If above solution work then you can try to make the credential file like you suggested, this should work. after adding domain parameter in credential file, remove that from fstab file. It may create conflict.

username=administrator
password=!mypass
domain=MYDOMAIN


Author

Commented:
and there in, as they say "lies the rub"

mount error(13): Permission denied

with:

//192.168.1.25/oa_backup /mnt/oa_bax cifs credentials=/root/.smb_credentials,domain=MYDOMAIN 0 0

for giggles I chmod'd .smb_credentials to 777 temporarily, no go.

It would appear that the credentials file is not being read, running as root (webmin) and being in the /root folder I would think all would be OK.

Commented:
After changing the permission now are you able to mount the share or still facing any issue.
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
//192.168.1.25/oa_backup /mnt/oa_bax cifs credentials=/.smb_credentials 0 0

in fstab

and

username=administrator
domain=MYDOMAIN
password=mypass!
{EMPTY LINE}

in /.smb_credentials

did the trick.  

Thank you for a straight-forward mount statement and and helping me get to the point of actually troubleshooting the issue with the credential file's path.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.