LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how can i run a shell scripts (or a number of commands )when a user logs in to a linu (https://www.linuxquestions.org/questions/programming-9/how-can-i-run-a-shell-scripts-or-a-number-of-commands-when-a-user-logs-in-to-a-linu-183701/)

rddreamz 05-20-2004 08:58 AM

how can i run a shell scripts (or a number of commands )when a user logs in to a linu
 
hi all , i amtrying to configure samba on mandrake 9.1 which wil share files from winxppro machine.i amusing smbmount for the perpose and can mount windows directories on muy linux machine.but now i want to run all those smbmount commands for a user automatically when that perticuler user logs into the linux machine.
i belive someone can help me doing this.
thanks in advance

Hko 05-20-2004 09:05 AM

Put those command in: ~/.bash_profile, ~/.bash_login, or ~/.profile whatever is most apropriate for your distro and login shell.

rddreamz 05-20-2004 09:47 AM

thanks a lot.i am trying that and let u know what happens.but i am not getting one thing that is, all those commands generates a password: prompt where the user need to provide password.what will happen if i run it automatically.how i cn the script/commands be answared automatically.

Hko 05-20-2004 11:07 AM

I've never used samba, but maybe this works:

echo "password" | smbmount bla bla

Note that it is quite insecure storing password in a script. At least check that group/other have no reading and execute rights on the script!

deiussum 05-20-2004 03:08 PM

If you are going to put the password right in the script like that, you could just as well do this for the mount portion:

Code:

mount -t smbfs -o username='DOMAIN\username',password=password \
    '\\server\directory' /mountpoint

This is pulled directly out of a script I have for mounting a samba directory, with the username and passwords substituted of course. ;)


All times are GMT -5. The time now is 06:20 PM.