I'm trying to automatically execute a command that mounts a password protected Samba share when my user logs in. The catch is, I share my laptop with another user, and I don't want the Samba share to be mounted when she logs in. I only want it to be mounted when I log in. That rules out editing my fstab file because I want this to be user-specific.
I've searched and reviewed lots of questions and answers related to mounting Samba shares, including "Mounting Samba Shares at boot/login and using script" and "Proper fstab entry to mount a samba share on boot," but most answers involve editing fstab, which works great for most people but that's not what I'm looking for here.
What I've done so far
I can manually mount the Samba share from the command line by doing this:
sudo mount -t cifs //centaroo.local/Me /media/Me -o uid=scott,gid=scott,credentials=/home/scott/.smbcredentials,iocharset=utf8,sec=ntlm,file_mode=0600,dir_mode=0700
The previous command works great when I execute it from the command line - it prompts me for my password to gain sudo permission, I enter it, and the command runs. The problem is, when I add the exact same command to the "Command" field in Startup Applications Preferences > Edit Startup Program, save my changes, reboot, and log back in, the Samba share isn't mounted like I expected. I suspect it's because I need root permission to run as sudo, and with the script in the Startup Programs Preferences, there's no way for me to enter it, so the script simply fails.
How can I work around this?