TechSpot

Network drives in ubuntu

By matrix86
Mar 31, 2010
  1. Let me start off by saying I have never used any linux software before, and am completely lost. However, my wife want it on her computer, so it's there.

    I need to know how to map a network drive in the latest Ubuntu. The drive is being mapped from my XP Pro machine to her Ubuntu machine. I have 2 folders on my external drive that she wants to be able to access from her computer.

    I have done some google searching, but with no luck. Answers are either a little complicated or don't tell me how to get to where I need to be to do what they are saying (and since those threads are a few years old, posting in there seems pointless).

    So I need to know what to do starting from the moment the desktop appears.

    I can run Windows completely wasted (drunk) with my eyes closed, but when it comes to linux, I have no clue what i'm doing (and I told my wife this when she said she wanted it...I told her if anything went wrong that she would need to wait a few days before i could fix it where-as Windows I would have it done that day...oh well, lol)

    Thanks for any help.
     
  2. jobeard

    jobeard TS Ambassador Posts: 13,474   +329

    First file sharing on Linux is done with Samba -- primarily to share Linux files with other systems like Windows and OSX.

    in the /etc/samba directory is smb.conf to control access to Linux resources from other systems; but you want the inverse.

    First logon to Linux as root, get the Terminal application and
    cd /
    mkdir /pcshareName​
    where pcshareName is the name of a specific share on one of your systems.
    repeat for every pcshareName that the linux needs access to.

    Prove you have access to the next command
    which smbmount​
    it should show the path that contains sbin and smbmount. If you don't find it, then you need to install Samba before proceeding

    the raw command to get pcshareName mounted is
    smbmount //winpc/pcshareName /pcshareName -o username=user,password=pass,rw

    winpc is the PCname where pcshareName may be found
    user usually the OWNER of the pcshareName
    pass and that OWNER'S password

    rw may be rw (to give write permission) or ro for read-only

    You may find that winpc is difficult to access by name --
    we'll solve that if necessary.

    Running smbmount as shown is unacceptable, but let's get that working before we hack the system startup ...
     
  3. jobeard

    jobeard TS Ambassador Posts: 13,474   +329

    automating smbmount

    automating smbmount

    >> Running smbmount manually is unacceptable ...

    So here's how to get it done at boot time OR to put it into a safe script
    for use when Windows is available.

    Most modern Linux systems use the /etc/rc system to control system startup.
    The system start is controlled using the /etc/inittab to process runlevels
    The runlevel scripts are in /etc/rc.d/ -- if you use
    ls -lF /etc/rc.d (that's a lower case L)​
    you will see directories rc.X.d/ (where X is 0->6) and the rc.local* executable file.

    We need the /etc/rc.d/rc.local script to be modified.
    I have modified the RC.LOCAL.TXT attachment for you
    On windows, you can edit this file with notepad; locate and edit ONLY the following

    ## we use a suffix to allow multple mounts
    mountpointA='/laptop';
    sysnameA='yourSysName';
    sharenameA='shareddocs';
    winuserA='owner';
    winpwdA='ownerpassword';
    winmodeA='rw';
    (1) mountpointA is where the Windows Share will be located on your Linux filesystem
    (2) sysnameA is the name of the Windows System which as
    (3) the sharenameA folder
    (4) winuserA is the owner of that folder
    (5) and windpwdA is the access password
    (6) windmodeA is either rw or ro

    Be sure there are no spaces and that you keep the QUOTEs as shown.

    save this file as rc.local.txt into a directory on Windows which will be mounted on Linux

    Here's the install process to get this active on Linux
    1. Boot Linux and login as root
    2. cd to the /etc/rc.d/
    3. manually mount the windows share
      smbmount //sysname/sharename /mountpoint -o username=owner,password=pass,rw ​
    4. copy your modified rc.local.txt to the linux system like this
      cp /laptop/rc.local.txt .​
      As Windows has \r\n as line terminators and Linux can only use \n,
    5. correct the script like this
      cat rc.local.txt | sed -e 's/\r//' >rc.local.txt2​
    6. save the original rc.local with cp rc.local rc.local_v1 and the install your new script
      cp rc.local.txt2 rc.local​

    To reset the system and mount using this script
    • ./rc.local stop
    • telinit 1
    • telinit 3
    (a) will dismount the first manual smbmount used to get access to the rc.local.txt
    (b) will put the system into Single User Mode
    (c) will continue back into Multi User Mode just like would be done from a BOOT of Linux
    and you will need to login again (root is not required)
    From a Terminal Session, you can see the Windows Share with ls /laptop or whatever you used
    as the mountpoint.

    In the GUI system, use the Computer icon->Filesystem and you will find /laptop listed and accessible there.

    Cleanup:
    1) on the Windows Share where you saved rc.local.txt --- delete that file to secure the password

    2) on Linux, cd /etc/rc.d/
    and set the permissions using su -c 'chmod 750 rc.local*'
    you'll need the root password
     

    Attached Files:

  4. matrix86

    matrix86 TS Maniac Topic Starter Posts: 804   +9

    Hey, thanks. I've been extremely busy and haven't had time to do this yet (i'm sitting in a cafe right now on my netbook...my first real break, lol). My wife is looking at it, though. She's used to working with Linux and is familiar with most of the command line type stuff in Linux. As soon as either she or I get it running, i'll let ya know. And i'll let ya know if we run into any problems. Thanks!
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.