Find the answer to your Linux question:
Results 1 to 4 of 4
I want to unmount a network drive on exit, so as no one else can access the mounting. I used the command "umount /mnt/hdrive" on the /root/ but when I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2003
    Posts
    15

    bash_logout


    I want to unmount a network drive on exit, so as no one else can access the mounting.

    I used the command

    "umount /mnt/hdrive" on the /root/
    but when I logout and logback in again the folder still exists... why is this?

    ===============================================
    The reason why im doing this is that when I log on to root, I want to mount a network drive using samba so that I can map a folder so i can access it with ease (like a home network drive). Once I login it asks me for a password - which is great, but if i log in again, it wont ask for a password n just have the folder there and anyone can access it. Thats why I want to unmount the path on exit


    Many thanks
    Ol i

  2. #2
    Linux Engineer Nerderello's Avatar
    Join Date
    Apr 2003
    Location
    North East England
    Posts
    1,190
    there are two things happening here.

    1st there is a sub-directory (folder) called /mnt/hdrive , this is as real a sub-directory as any other (your home sub-directory for instance). You are then mounting a hard disk (I assume from the name) onto this sub-directory (and unmounting it with the umount command).

    So, if you do a listing of /mnt/hdrive (ie. ls /mnt/hdrive -alF) you should see the files and sub-directories of that hard disk. Then if you unmount the hard disk and then repeat the listing, you should only see the empty sub-directory.

    Be aware that you can automatically mount disks by including them within /etc/fstab (go on, have a look at what's there now - cat /etc/fstab)

    have fun

    nerderello

  3. #3
    Just Joined!
    Join Date
    Jul 2003
    Posts
    15
    Im mounting the network drive {//it-staff/okh$} using the command:
    mount -t smbfs -o username=okh //it-staff/okh //mnt/hdrive
    I have placed the above command in the .bashrc file (located root/).

    This all works fine, but I want to unmount this file when the root logs out.

    I have tried placing:
    umount /mnt/hdrive
    in the .bash_logout (located root/
    this does not unmount the drive! (its not because the drived is mounted everytime root logs in because I have temp removed the mount line from the bashrc file).

    SO:
    If you say I should mount the drive in the fstab file, should it look something like this:

    /dev/hda7 / ext2 defaults 1 1
    /dev/hda6 swap swap defaults 0 0
    /dev/cdrom /mnt/cdrom auto noauto,ro,user 0 0
    none /proc proc defaults 0 0
    none /proc/bus/usb usbdevfs defaults 0 0
    none /dev/shm tmpfs defaults 0 0
    none /dev/pts devpts gid=5,mode=620 0 0
    //it-staff/okh$ /mnt/hdrive smbfs defaults 0 0


    Is this right? But if that works, how am I ment to unmount then on log-off? As I dont want other users to see it when they login?
    And if im fealing really adverterus, could it be possible to mount a specific network drive per user?
    :P

  4. #4
    Just Joined!
    Join Date
    Jul 2003
    Posts
    15

    Basically I dont think its looking at bash_logout

    I dont think it is reading the .bash_logout file, any ideas?
    :cry:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •