How to mount a samba share at login

5,872

Add the command to mount the share at the end of ~/.bash_profile. This will execute the command when you login.

Share:
5,872

Related videos on Youtube

screenslaver
Author by

screenslaver

Updated on September 18, 2022

Comments

  • screenslaver
    screenslaver over 1 year

    I need to mount a smb share in my laptop. I added it in fstab, but it doesn't seem to be mounting at boot. I need to type mount -a manually to mount it. I think it is because the laptop is not getting connected to the network when its booted. I tried to add a cron to mount it 1 minute after reboot, but it is also not working.

    Since I am the only one using this laptop, it is Ok to mount it when I login. So how to add a cronjob to mount it when I login ?

    OS: ubuntu 16.04

    samba running in a raspberry pi in home network

    • Organic Marble
      Organic Marble over 7 years
      Can you post the relevant line in your fstab? My setup mounts samba shares every boot with no trouble.
    • screenslaver
      screenslaver over 7 years
      @OrganicMarble //192.168.1.200/movies /movies cifs username=root,password=xxxx 0 0
    • Organic Marble
      Organic Marble over 7 years
      Try adding ,nobootwait after your ,password=xxxx entry. My fstab entries also have ,iocharset=utf8,sec=ntlm,file_mode=0777,dir_mode=0777,uid=[m‌​e],gid=[me], but I don't know if that is relevant to your problem.
    • screenslaver
      screenslaver over 7 years
      adding nobootwait did not solve the problem. let me try with all these entries
    • Organic Marble
      Organic Marble over 7 years
      Your tag says you have 14.04 but your question says 16.04. It's important because 16.04 doesn't support nobootwait. If you really have 16.04, try nofail instead.
    • screenslaver
      screenslaver over 7 years
      none of them worked
    • Organic Marble
      Organic Marble over 7 years
      Sorry, out of ideas :(
    • d a i s y
      d a i s y over 5 years
      Try this.
  • jchook
    jchook over 6 years
    I have done this but the drive does not mount. I think it may have to do with network services being unavailable when it attempts to mount.
  • Admin
    Admin about 4 years
    Did you install "cifs-utils"?