LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied (http://www.linuxquestions.org/questions/linux-newbie-8/manual-mount-cifs-works-but-srcipt-mount-cifs-has-mount-error-13-permission-denied-769164/)

CADIT 11-14-2009 03:14 PM

manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied
 
Hi,
This is my first post, hope someone can help.
I have a Windows 2003 SBS Server and a Debian Lenny 2.6.26-1-686 fileserver setup with samba connected on the active directory and all working fine.

I am trying to test scripting to use on other servers with a similar setup. So I manually run this command to mount a windows share...

# /sbin/mount.cifs //windowsserver/share /mnt/share -o username=someuser,password=somepassword

I then run rsync and umount manually. All works fine the way I want.

My next step is I want this to run as a script in CRON, so I create a backup.sh file in /usr/local/bin/
--------------------------------------------
# mount network drive
/sbin/mount.cifs //windowsserver/share /mnt/share -o username=someuser,password=somepassword

# sync the network drive to local drive
rsync -avz /mnt/share /tmp

# unmount the network share
umount //mnt/share
---------------------------------------------

I am loged in as root and run # /usr/local/bin/backup.sh
and get the following error

fileserver:~# /usr/local/bin/backup.sh
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

I have also tried with DOMAIN/username and -o,username and with -o domain=DOMAIN,username etc etc

all files are up to date on standard debian lenny apt-get update/upgrade
the only difference that might be is I had to compile a new version of Samba to work correctly with SBS2003 Active Directory, but this issue shouldnt be anything to do with samba.
Hopefully someone can help
D

madmadmod 11-14-2009 03:55 PM

what happens if you put the mount command in a script and run the script from a shell (not from crontab)?

PTrenholme 11-14-2009 05:18 PM

Quote:

Originally Posted by madmadmod (Post 3757200)
what happens if you put the mount command in a script and run the script from a shell (not from crontab)?

Um, not to be picky, but did you read the post? The last failure was when CADIT ran the script from a terminal as "root."

Anyhow, I can't see why the reported problem happens. Sorry.

Guyverix 11-14-2009 11:07 PM

Have you tried the command with the -v option in your script so you can get some more verbose information from when it is trying to mount? I found an old post from someone else having this problem and they were able to compare what was being sent for authentication when using -v

The post is old, but it might assist in troubleshooting.

http://fedoraforum.org/forum/archive...p/t-41910.html

madmadmod 11-15-2009 01:44 AM

@PTrenholme: sorry, you are right. i did not read the post carefully enough.

Guyverix is right. try the -v or even -vvv option. I did cifs mounts on AIX and had some problems with '*' in the password in beginning.

good luck

CADIT 11-16-2009 05:04 AM

Thanks for all your help - its now working
 
Thanks for your help, all is now working. The following is what has changed

OLD COMMAND
# /sbin/mount.cifs //windowsserver/share /mnt/share -o username=someuser,password=somepassword

NEW COMMAND THAT WORKS IN MY SCRIPT
# mount.cifs //serverip/share /mnt/share -o ip=serverip,user=someuser,pass=somepassword ,dom=domainname

I also had a problem with my # umount //mnt/share it should have been # umount /mnt/share

Thanks

TomFunke 11-20-2009 03:48 PM

Workaround for mount.cifs error 13
delete linefeed after your password in the credential file
see also kbase.redhat.com/faq/docs/DOC-21451


All times are GMT -5. The time now is 08:13 PM.