mvdw n00b
Joined: 12 Mar 2004 Posts: 9 Location: Brisbane, Australia
|
Posted: Thu Jun 02, 2005 11:58 am Post subject: Roaming laptop & mounting shares.. |
|
|
Hi all:
I want to move my laptop between several sites, and mount assorted shares depending on where I am. For example, if I'm at home, I want to mount gentoo-server:/usr/portage/distfiles on /usr/portage/distfiles, while if I'm at work, I want to mount my the SMB shares I have access to onto an appropriate point. Normally, this isn'ta problem, however I have to get around the problem of inputting the smb domain password.
My normal way of working is to shutdown the laptop between sites, and I have dhcp servesr at home and at work to give out the IP (different at each site), so my first thought was to run a script at startup and mount the shares depending on the value of the IP of the laptop, however it won't work for the samba shares since they need the password in an interactive manner (I'm reluctant to put the password on the laptop in any form).
Here's the start of the script I was writing:
Code: |
#!/bin/bash
# Script to mount the shared network drives, depending on
# the network state.
#
# If we're on the home network, we want to mount /home/shared and
# /usr/portage/distfiles; if we're on the work net then we want to
# mount /mnt/m_drive (via samba)
#
# Version 1.0 20050602
#
HOMEIP=22.22.22.22
WORKIP=33.33.33.33
if (( $(/sbin/ifconfig -a | grep -c $HOMEIP ) > 0 )) ; then
mount server:/home/shared /home/shared
mount server:/usr/portage/distfiles /usr/portage/distfiles
fi
if (( $(/sbin/ifconfig -a | grep -c $WORKIP ) > 0 )) ; then
mount -t smbfs //server/share /mnt/mntpoint -o username=USER,workgroup=DOMAIN
fi
|
Any ideas on:
(a) Where I should run it (at startup or at login as user)? At startup is the most logical, however at login I can popup an X window for the password.
(b) How to get the password? How do I get the password from an X window to the mount command, and/or is there a better way to do it? Note that we run a domain controller at work, so everything is centrally authenticated.
Cheers,
mvdw |
|