Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Roaming laptop & mounting shares..
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mvdw
n00b
n00b


Joined: 12 Mar 2004
Posts: 9
Location: Brisbane, Australia

PostPosted: Thu Jun 02, 2005 11:58 am    Post subject: Roaming laptop & mounting shares.. Reply with quote

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
Back to top
View user's profile Send private message
rusty
Apprentice
Apprentice


Joined: 07 May 2004
Posts: 181
Location: St.Louis

PostPosted: Fri Jun 17, 2005 2:44 pm    Post subject: Re: Roaming laptop & mounting shares.. Reply with quote

mvdw wrote:
Hi all:
(b) How do I get the password from an X window to the mount command

This:
Code:
PASSWORD=`zenity --entry`

... will prompt you for an entry and then set the variable $PASSWD to whatever you respond with. Note that the password will be in clear text.[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum