LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-20-2004, 08:58 AM   #1
rddreamz
LQ Newbie
 
Registered: Jul 2003
Posts: 24

Rep: Reputation: 15
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
 
Old 05-20-2004, 09:05 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Put those command in: ~/.bash_profile, ~/.bash_login, or ~/.profile whatever is most apropriate for your distro and login shell.
 
Old 05-20-2004, 09:47 AM   #3
rddreamz
LQ Newbie
 
Registered: Jul 2003
Posts: 24

Original Poster
Rep: Reputation: 15
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.
 
Old 05-20-2004, 11:07 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
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!
 
Old 05-20-2004, 03:08 PM   #5
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 31
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can execute some commands when a user logs out rddreamz Programming 2 05-25-2004 03:00 PM
how to make/run startup scripts/commands ViN86 Slackware 3 04-24-2004 10:02 AM
Linux commands in shell scripts james_cwy Linux - Newbie 4 11-10-2003 01:14 AM
Mail daily logs through shell scripts klnasveschuk Linux - Software 0 08-07-2003 05:02 AM
Scripts won't run commands Xyphoid Linux - General 4 08-08-2002 08:49 PM


All times are GMT -5. The time now is 09:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration