Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up the cron job at reboot like

 @reboot sleep 20;mount -a

BUt i have received he email that it asks for password

how can i supply password with mount

share|improve this question
can you give us a little more info from the email - what is the error reported ? – Iain Oct 14 '10 at 8:28
You'll need to add more detail to your question, preferably the contents of /etc/fstab and the message you're seeing in the email. As it is now your question isn't answerable and will probably be closed. – ThatGraemeGuy Oct 14 '10 at 8:36
Btw, you may want to put the script in /etc/rc.local or /etc/rcS.d/, which should grant to be run quite after all other stuff. – LatinSuD Oct 14 '10 at 9:48
Oh boy, don't do that. Use one of the saner ways, like init scripts, backgrounded mounts in case of NFS or autofs/automount. – al. Oct 14 '10 at 13:51

If you mean with CIFS, then look at the user, password and credentials mount options. See the mount.cifs(8) man page for more details.

share|improve this answer

mount -a it's a "Mount All Filesystem", so you need root privileges. Just install the cronjob with

crontab -e

while logged in as root, or edit /etc/crontab and modify the entry like:

0 * * * * @reboot root /bin/mount -a
share|improve this answer
while loogged as root , i typed crontab -e ND THEN @REBOOT SLEEP 20; mount -a . then i receievc the email which has only one line "password:" or wait a minute--> i think may be that mail was from other file which i put in /etc/init.d/after.local which also contain mount -a and that was not root user. Looks like problem is solved – John Oct 14 '10 at 11:17
You wouldn't get a password prompt if mount is run from the wrong uid. Just something like "only root can do that". – al. Oct 14 '10 at 13:48
@al mmm ... you're right. Never notice that. – Mr Shunz Oct 14 '10 at 14:11
u r right , i also get the passowrd prompt on next reboot – John Oct 14 '10 at 22:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.