how to execute automatically a program/script after login
hi guys,
i struggle with samba with my linux-clients, as there is (for me) no real solution to mount my shares automatically: fstab needs fixed entries per share, even with credentials, you need one entry per user. makes for me 5 mountpoints on one client. so, i think, it would be a possibiliy to use a credentials-file within the users-dir. and then executing a shell-script after the login having someting like: mount -t smbfs -o credentials=/home/$User/.credentials //server/share /$USER/mntdir AND LET IT EXECUTE LINUX AUTOMATICALLY AFTER A SUCCESSFUL LOGIN! so, i would get a kind of login-script as you have it in windows. does anybody know: a) how to execute automatically this script after the successful login? b) whether this shell-script would work? THANKS for any reply Cheers, Roger |
i think there is one startup folder in the "/home/ur account" folder that act the same as windows start\all programs\startup
just place a link there a symbolic link in that folder and youoff and go |
'classical' linux user startup file is ~/.login placed in every user's home. Consider also changing the template for new users in /etc/skel
You can alternatevely leave homes unchanged and change /etc/csh.login and /etc/bash.bashrc, however note these will probably be launched again when a new xconsole is opened. |
I'm not too sure which "logon" you want to refer to...
Shell logon, samba logon, domain logon etc If you want to mount a user's files as shares for other people to use, after they have connected to Samba, you can use the preexec and postexec functions in samba.. They are used to mount cdroms once someone browses the share, and remove the mount when they exit, but they can of course mount other things as well... You can also run them as root using root preexec & root postexec Give them an individual share to browse first then personalise the mount. Make the mount directory one below the share directory so they can see all the possible mounts. |
Thanks for your tips, i did as followed:
i placed a script called mount.sh in /etc/profile.d. I had to do someworkaround, as at this location, the system reloads this script at eachcall of bash or nautilus.My script is as followed: #!/bin/bash more /etc/mtab | grep smbfs > /home/$USER/EOFile read ende < /home/$USER/EOFile #echo $ende if [ "$ende" = "" ]; then sudo mount -t smbfs -o credentials=/home/$USER/.credentials,uid=$USER,gid=grosswiler,fmask=777,dmask=777,rw //morpheus/$USER /home/$USER/winpriv sudo mount -t smbfs fi ...and this works...somehow.... |
Hi Mule,
I read your dilemma. I had a similiar situation some time ago and this is what I read about in a huge samba book I bought. Have the windows boxes connect via network drives. You can do that with the Net Use command in the windows command prompt. Make certain to put in there persistent:yes to make certain the network drives will initalize at start up. Also, you can set your permissions file and folder specific should you wish. I don't know if this is what you're looking for, but I thought it might help. Take care and good luck! |
hi scott,
Thanks for your idea. But the Window-Boxex are no problem. i put there a login-script into the netlogon-share. This is executed, as a Windows-Client authenticates itself on the samba-domain. WINDOWS MACHINES ARE NO PROBLEM! a sad fact, as i have more linux-clients... if you want to, i send you my login.bat placed in the netlogon-share of my samba-server, perhaps this helps you also a little bit....always appreciated to help people trying to help me!! |
Oh, this is a domain controller?? I have never set up a Linux DC. Sorry.
|
this is no problem, scott, just a few more minutes of engagement for the installation, but extra for a network at home with several clients....the samba-pdc (i have samba version 3.0.x) is very reliable and some magazine say even quicker than windows 2003. at least: no cost for licenses on the server....
if you are intersted: o'reilly put their book from samba (printed: about 600 pages) online, without any cost for everybody at http://www.oreilly.com/catalog/samba2/ if you need any more help (for your windows-clients, seems i don't bring the linux-clients proper in network before christmas :-) let us know... |
All times are GMT -5. The time now is 10:57 AM. |