0

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

  • 1
    can you give us a little more info from the email - what is the error reported ? – user9517 Oct 14 '10 at 08:28
  • 2
    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 08: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 09: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

2 Answers2

1

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.

Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84
0

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
Daniele Santi
  • 2,529
  • 1
  • 25
  • 22
  • 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 –  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. – Daniele Santi Oct 14 '10 at 14:11
  • u r right , i also get the passowrd prompt on next reboot –  Oct 14 '10 at 22:50