LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

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

Rep: Reputation: 15
how can i run smbmount automatically when a user login


hi all,
i want to use winxppro as my file server and linux(mandrake9.1)as a client.situation is of following
1.i have 5 directories on ntfs partitions on my winxppro(a,b,c,d,e,f).
2.i have 5 different users 1,2,3,4,5 who has diferent partitions on those directories.
3.i have 5 users with smbpaaswd created on my linux pc .
4.for each user i have written a scripts file where i have actually placed smbmount commands with proper permissions set for each user for each directory.e.g
smbmount //win/a /home/1/win rw,username=<>,password=<>,uid=<>,dmask=0765,fmask=0765

5.i have five scripts written for each user with different set of permiossions on diffferent directories

6. when user 1 runs this it asks for passwords for different directories and after providing proper passwords he can share directories on winxp with proper rights.

but users find it reallydifficult to provide passwords for each directories.so i want to run these scritps whenever a perticuler user logs in (locally), when they logoff locally these all mount points should be umounted automatically.

i belive there should be solution to this and somebody can help me to do this.

thanks in advance.
 
Old 02-15-2006, 06:40 PM   #2
tonyfreeman
Member
 
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 187

Rep: Reputation: 30
smbmount during gui login

Sorry I don't have an answer ... I have the basic same question.

Where does one put the smbmount command in order to mount drives in a user's home directory when that user logs in to a GUI (such a gnome, kde, etc):

smbmount //blahblah/blah ~/drives/blah rw,exec,guest

I would rather the smbmount command not run when the user accesses his/her profile via other mechanism such as ssh. Only mount the drives when he/she sits down at the workstation and opens a desktop manager (gnome, kde, enlightenment, fluxbox, etc).

Any ideas?
 
Old 02-15-2006, 08:50 PM   #3
soulestream
Member
 
Registered: Nov 2005
Posts: 183

Rep: Reputation: 30
.bashrc or .bash_profile should do it

Folder permissions should be set on the ntfs side, not on the client side.

You shouldnt need smbpasswd at all. The only time that should matter is if you are logging into a domain controller.

you can use fstab and sudo, probably with better security as well as then using credentials files(instead of username=blah, password=blah)that are only visible by root.

soule
 
Old 02-17-2006, 10:14 PM   #4
tonyfreeman
Member
 
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 187

Rep: Reputation: 30
.bashrc and .bash_profile not good to automount drive

Hello soulestream,

Thanks ... but adding smbmount to those files doesn't work as I'd like.

.bash_profile doesn't mount the drives at all.
.bashrc mounts them every single time I open a terminal such as gnome-terminal (multiple mounts of the same drive start stacking up for the same user).

Here's the code that I put at the end of .bash_profile and then at the end of .bashrc:

Code:
# mount smbshares to drive directory:
smbmount //linkstation/books  ~/drives/books  -o guest,rw,exec
smbmount //linkstation/games  ~/drives/games  -o guest,rw,exec
smbmount //linkstation/movies ~/drives/movies -o guest,rw,exec
smbmount //linkstation/music  ~/drives/music  -o guest,rw,exec
smbmount //linkstation/share  ~/drives/share  -o guest,rw,exec
So I started fooling with /etc/fstab. The fstab file chokes when I add an entry like this:

Code:
//linkstation/share ~/drives/share smbfs rw,exec,guest 0 0
... and a command like this:

Code:
sudo mount -a
Could not resolve mount point ~/drives/share
Anyone have ideas about how to automount drives (be it in the user's home directory or elsewhere) when the user logs into a desktop manager (gnome, kde) rather than when the user opens a ssh session or every time a terminal is opened.

I'd also like the mount points to be release when the user logs out.

-- Tony
 
Old 02-18-2006, 03:10 AM   #5
Bugger
LQ Newbie
 
Registered: Dec 2005
Location: Hyderabad, India
Distribution: Red Hat, Fedora Core
Posts: 16

Rep: Reputation: 0
well,
Better write all the mount commands in a shell script and call it form .bashrc...
but first check for already mounted file system in u r script file...
like
#!/bin/bash
count=`mount | grep -c drives/books`
if [ count -lt 1 ]; then
# u r mount statement goes here
fi

I feel you have to apply conditions for all your file systems... and the call this script from any file which is executed automatically, say at startup or say .bashrc

Regards,
ANU
 
  


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 to run a Script as root, after Login as User, in GDM MHOOO Red Hat 14 03-08-2005 08:41 AM
I want to automatically run a program when a user logs on their account bad_andy Linux - Newbie 7 02-01-2005 08:55 PM
automatically login a user thebover Linux - Software 3 08-26-2004 08:00 AM
Where to run scripts automatically on login/logout hilltop*Tech Linux - General 2 02-06-2004 10:59 AM
Getting vncserver to run automatically when user logs in indespair Linux - Networking 2 10-26-2003 02:37 AM


All times are GMT -5. The time now is 02:23 AM.

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