LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-04-2007, 08:00 AM   #1
zmsc1
Member
 
Registered: Apr 2006
Location: South Yorkshire, GB
Distribution: SuSE, DSL
Posts: 34

Rep: Reputation: 15
Script to mount a share


Hi All,

Using OpenSuse 10.2 in a Windows and Active Directory environment, I want to mount a couple of Windows shares as painlessly as possible. I've read lots of advice about what should be in fstab, all the relevant man pages, lots of postings, but everything I've tried so far won't work.

Here's the situation ...

At the command prompt as root, I issue the command

mount -t cifs -o user=domain\userid,pass=password //10.208.13.5/groups$ /home/zmsc1/i

That works perfectly! The share "groups$" is mounted in my home directory in the folder "i" (because the Windows users around here commonly call this share the "i" drive).

I know about credentials files, but I want to sort out the basics first.

I put that command in a script, but couldn't get it to work in that form, so I've modified the script to read

su -c "mount -t cifs -o \"user=domain\\userid,pass=password\" \"//10.208.13.5/groups\" \"home/zmsc1/i\""

Not clear to me why the escapes and quotes are needed, but they are and the script works if I call it in a terminal then when prompted provide the root password.

So my question is, how can I get that script to run on boot? I tried putting it in /etc/rc.d/rc5.d but it didn't do anything. I took out the su -c bit as there wouldn't be any way to put the root password in at boot. And I made root owner of the script. And yes, I did set the file as executable.

Anyone can see where I've gone wrong?

TIA,
Stuart
 
Old 09-05-2007, 02:23 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
ok well files in rc5.d are *links* to a *service* script. service scripts respond to "start" "stop" etc.. not just a generic command. secondly you shouldn't be running it like this anyway. just add a line to your fstab file and it will naturally mount it automatically...

//server/share /home/zmsc1/i cifs auto,username=xxx,password=yyy 0 0
 
Old 09-05-2007, 07:41 AM   #3
ElvisImprsntr
Member
 
Registered: Aug 2007
Location: Florida
Posts: 33

Rep: Reputation: 19
Try this

http://www.linuxquestions.org/questi...d.php?t=581128
 
Old 09-05-2007, 07:59 AM   #4
zmsc1
Member
 
Registered: Apr 2006
Location: South Yorkshire, GB
Distribution: SuSE, DSL
Posts: 34

Original Poster
Rep: Reputation: 15
Success

Thanks Chris,

I'd tried before in fstab, using username=domain\\name. At the command line, you need the double backslash and I assumed it's the same in fstab. But not so! So for the benefit of others viewing this thread, if you want to mount a share on a domain from fstab, you need

//server/share$ /mount/point cifs auto,user=domain\user,password=whatever 0 0

But see elsewhere on use of a credentials file rather than leaving your domain password in an easy-to-find place.

Stuart
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't mount samba share and then write to the share calbazon Linux - Software 8 10-10-2010 01:35 AM
NFS mount of smb mount of windows share: permission denied problem :( Bagatur Linux - Networking 4 07-07-2009 11:34 AM
show the samba share but can't mount the share badall Linux - Server 3 05-30-2007 04:24 AM
shell script to mount samba share with " " in the remote path dohpaz Programming 2 10-20-2006 02:18 PM
FSTAB: My Win Share Wont Mount @ Boot, but will when I sudo mount -a...please help! TruANTOlogy Ubuntu 8 06-20-2006 08:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration