LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-19-2009, 08:12 AM   #1
stuaz
Member
 
Registered: Dec 2008
Posts: 59

Rep: Reputation: 15
rcl.local - mounting a drive


Hello,

I am attempting to use rc.local to run a command to mount a drive using the following command:

/bin/mount -t cifs //<IP ADDRESS>/<DIRECTORY> --verbose -o user=USER,pass=PASS,dom=DOMAIN /mnt/ntserver

When I place it in the rc.local file and execute the rc.local file it works with no issues and mounts the drive fine. However If I save the output to a file and reboot the server I get the following error message, and it doesn't mount:

Log of /bin/mount -t cifs //<IP ADDRESS>/<DIRECTORY> --verbose -o user=USER,pa
ss=PASSWORD,dom=DOM /mnt/ntserver
Thu Mar 19 12:48:02 2009

parsing options: rw,user=USER,pass=PASSWORD,dom=DOM

mount.cifs kernel mount options unc=//<IP ADDRESS>\<DIRECTORY>,ip=<IP ADDRESS>,v
er=1,rw,user=USER,pass=PASSWORD,dom=DOM
mount error 113 = No route to host
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
/bin/mount died with exit status 255

The route to host message is normally displayed when no network card is present or functioning - but I thought rc.local was the last thing to run?
 
Old 03-19-2009, 08:46 AM   #2
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Have you tried mounting it using /etc/fstab? You can use a credentials file to hide the username and password from prying eyes (by keeping it in /root, for example):
Code:
//<IP ADDRESS>/<DIRECTORY>   /mnt/ntserver       smbfs   credentials=/root/smb.pass  0   0
Code:
$ cat /root/smb.pass
username=USER
password=PASSWORD
 
Old 03-19-2009, 09:37 AM   #3
stuaz
Member
 
Registered: Dec 2008
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pwc101 View Post
Have you tried mounting it using /etc/fstab? You can use a credentials file to hide the username and password from prying eyes (by keeping it in /root, for example):
Code:
//<IP ADDRESS>/<DIRECTORY>   /mnt/ntserver       smbfs   credentials=/root/smb.pass  0   0
Code:
$ cat /root/smb.pass
username=USER
password=PASSWORD

Hi Thanks for your response.

I did try that, but the problem I have is the options codes I use. How are they put in the fstab?
 
Old 03-19-2009, 12:38 PM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
The username and password are stored in the credentials file (/root/smb.pass in my example). Any other options are before or after the credentials option:
Code:
//<IP ADDRESS>/<DIRECTORY>   /mnt/ntserver       smbfs   credentials=/root/smb.pass,domain=DOMAIN,rw  0   0
The layout of fstab is:
Code:
blockdevice mountpoint filesystemtype mountoptions filesystemdump fsckcheck
In essence, the 5th and 6th ones you don't need to worry about and can leave as 0 and 0 respectively. Take a look at man mount.cifs on the specific options you can include and their syntax. Also see man 5 fstab for the syntax of /etc/fstab.

Also, I just realised why your first attempt may have failed; the correct syntax for specifying the domain is domain=DOMAIN, NOT dom=DOMAIN.
 
Old 03-19-2009, 03:52 PM   #5
stuaz
Member
 
Registered: Dec 2008
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks again for the help, but it still doesn't work:

Contents of fstab

Code:
//<IP ADDRESS>/<DIRECTORY>       /mnt/ntserver   smbfs   credentials=/root/smb.pass,domain=DOMAIN,rw 0       0
Code:
# ls -l /root/smb.pass
-rw-rw-rw- 1 root root 34 Mar 19 20:43 /root/smb.pass
# cat /root/smb.pass
username=USERNAME
password=PASSWORD
 
Old 03-20-2009, 03:33 AM   #6
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Are there any new error messages in /var/log/messages about it trying to mount during boot? What if you type mount -a as root? Any errors there? Are you sure you need the domain switch (with mine, I found it worked without it whereas it didn't with...)?

Also, do a chmod go-rw /root/smb.pass so that only root can see the username and password you're using to connect to the samba share.
 
Old 03-20-2009, 04:10 AM   #7
stuaz
Member
 
Registered: Dec 2008
Posts: 59

Original Poster
Rep: Reputation: 15
/var/messages doesn't report any error messages that I can see.

Code:
# mount -a
mount: unknown filesystem type 'smbfs'
I took domain out as well, and that didn't work.
 
Old 03-20-2009, 04:31 AM   #8
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
So it's not working because it doesn't recognise smbfs as a valid filesystem, yet you can successfully mount it from the command line? Try changing smbfs to cifs as they're synonymous.
 
Old 03-20-2009, 05:05 AM   #9
stuaz
Member
 
Registered: Dec 2008
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pwc101 View Post
So it's not working because it doesn't recognise smbfs as a valid filesystem, yet you can successfully mount it from the command line? Try changing smbfs to cifs as they're synonymous.
Nope no difference.
 
Old 03-20-2009, 05:13 AM   #10
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Can you at least still mount it using the credentials file from the command line, as per your original post?
Code:
mount -t cifs //<IP ADDRESS>/<DIRECTORY> -o credentials=/root/smb.pass,domain=DOMAIN /mnt/ntserver
 
Old 03-20-2009, 06:23 AM   #11
stuaz
Member
 
Registered: Dec 2008
Posts: 59

Original Poster
Rep: Reputation: 15
Yep that works perfectly when run manually.
 
Old 03-20-2009, 06:45 AM   #12
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Don't know then. Sorry.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
specify encoding method when mounting a local drive benben_shen Linux - Software 3 04-02-2006 04:12 AM
Mounting Local Logical Partitions Reject476 Fedora 1 01-08-2006 02:42 PM
mounting local hard drive in a remote shell (SSH) noir911 Linux - General 1 06-24-2005 05:55 AM
mounting local hard drive, permissions plasticus Linux - Hardware 5 02-15-2004 03:14 PM
Cannot Copy Files From Network FAT32/NTFS Drive to My Local Linux Drive michaelh Linux - Networking 3 10-29-2002 10:27 AM

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

All times are GMT -5. The time now is 12:19 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration