Ubuntu – How to mount a samba share at login

16.04cronmountsamba

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

Best Answer

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