?
Solved

Ubuntu - Permanently mount Windows Network Share

Posted on 2011-04-21
8
Medium Priority
?
1,462 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.


 
0
Comment
Question by:Michael Knight
  • 5
  • 3
8 Comments
 
LVL 12

Accepted Solution

by:
upanwar earned 2000 total points
ID: 35443322
Have you tried to maually mount the sahre with below given command.

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

Please try it and update the ststus.
0
 
LVL 9

Author Comment

by:Michael Knight
ID: 35443946
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
0
 
LVL 12

Assisted Solution

by:upanwar
upanwar earned 2000 total points
ID: 35446936
Please make the below given entry in fstab to mount the windows share after reboot.

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

after making this entry in fstab, first umount the existing mounted windows share and then execute below given command to verify whether the entry in fstab is working or not.

# mount -a
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:upanwar
ID: 35446942
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


0
 
LVL 9

Author Comment

by:Michael Knight
ID: 35449518
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.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35449599
After changing the permission now are you able to mount the share or still facing any issue.
0
 
LVL 12

Assisted Solution

by:upanwar
upanwar earned 2000 total points
ID: 35452066
If you suspect that credentials file is not getting read in /root then try to keep it in /.smb_credentials instead of /root/.smb_credentials.
0
 
LVL 9

Author Closing Comment

by:Michael Knight
ID: 35462313
//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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question