put the samba mount command as an executable in one of your $PATH folders, you can find them trough
echo $PATH
for example the /usr/local/bin is usaly in the $PATH. an example samba mount file:
#! /bin/bash
sudo smbmount //192.168.2.28/projects /mnt/projects -o user=$1
So now you have a /usr/local/bin/mountsamba.sh, To let anyone run this:
# chmod u+x /usr/local/bin/mountsamba.sh
The third step is to allow the newly created executable to be executed as root without password, this requires editing of the sudoers file:
#visudo
and add:
%samba_mount_group ALL=(root) NOPASSWD: /usr/local/bin/mountsamba.sh
now all users can in the samba_mount_group can execute that command as sudo without password. you probalby also want to
- create a group: linux.die.net/man/8/groupadd
- add an user to a group: www.cyberciti.biz/faq/howto-linux-add-user-to-group/
finaly to mount the folder on user login put the command in the target user's .bashrc
$ echo "cur_user=$USER; sudo bash /usr/local/bin/mountsamba.sh $cur_user" >> .bashrc
(note: this should be executed as the target user) assuming they boot in the bourne again shell terminal