Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-20-2004, 08:04 AM   #1
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 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, 07:40 PM   #2
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 196

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, 09:50 PM   #3
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.

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

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:

# 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:

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

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, 04:10 AM   #5
LQ Newbie
Registered: Dec 2005
Location: Hyderabad, India
Distribution: Red Hat, Fedora Core
Posts: 16

Rep: Reputation: 0
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...
count=`mount | grep -c drives/books`
if [ count -lt 1 ]; then
# u r mount statement goes here

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



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

All times are GMT -5. The time now is 03:48 AM.

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