Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: How to make your root partition visible under windows network

  1. #1
    Join Date
    Feb 2010
    Posts
    638

    Default How to make your root partition visible under windows network

    NOTE: Improved perpetual method supplied in post #5 below:

    I already had my HDD & USB visible, but I wanted to able to see/copy to and from the root partition.

    So here's how I added that:

    Add this line to your to the end of your /usr/local/etc/rcS file:
    Code:
    /usr/local/etc/custom &
    make a file called custom in the /usr/local/etc/ directory

    Code:
    cd /usr/local/etc/
    vi custom
    Then enter the following information into that file:
    Code:
    mount / -o remount,rw
    sleep 50
    #mkdir /tmp/hdd/volumes/BT/
    #mount /dev/sda3 /tmp/hdd/volumes/BT
    cd /tmp/smb/
    cp /usr/local/etc/smb.conf smb.conf
    /tmp/package/samba/sbin/smbd -D
    mount -o remount,r /
    *note that I have commented out the third & fourth lines- those have to do with my ipkg installation. You could probably comment out the sleep 50 too, but I haven't tried it yet.

    and finally make a copy of your smb.conf file in your /usr/local/etc directory:

    Code:
    cp /tmp/smb/smb.conf /usr/local/etc/smb.conf
    then edit your /usr/local/etc/smb.conf file as follows:

    Code:
    [global]
    security=share
    log file=/usr/local/samba/var/log.%m
    max log size=2000
    domain logons=Yes
    dns proxy=No
    use sendfile=yes
    guest account=root
    encrypt passwords=yes
    passdb backend=smbpasswd
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=8192 SO_RCVBUF=8192
    read raw=yes
    write raw=yes
    oplocks=yes
    max xmit=65535
    dead time=15
    getwd cache=yes
    lpq cache=30
    read prediction=yes
    client NTLMv2 auth=yes
    [C]
    path=/tmp/usbmounts/sdb1
    hide dot files=no
    hide files=/.*/lost+found/
    guest ok=yes
    writable=yes 
    force create mode=0775 
    force directory mode=0775 
    [HDD]
    path=/tmp/hdd/volumes/HDD1
    hide dot files=no
    hide files=/.*/lost+found/
    guest ok=yes
    writable=yes 
    force create mode=0775 
    force directory mode=0775 
    [root]
    path=./
    hide dot files=no
    hide files=/.*/lost+found/
    guest ok=yes
    writable=yes
    force create mode=0775
    force directory mode=0775
    You're basically changing the hide dot files line from yes to no in the C (that's your usb drive) and HDD (that's your internal harddrive) and then adding the root section.

    This gives you access to the root partition of the pbo from your windows share: that is, double click on Network, double click on VENUS, and you'll see C, HDD, & root- assuming you have a usb and hard drive installed.

    You'll see the changes on reboot.

    It is your root partition, so be careful.

    There are likely less cumbersome ways of doing this, this is just the way I have stumbled upon.

    I did this last night and have of course lost track of the original source of this knowledge. So thanks to that Masked Linux Guru, whoever he is.
    EDIT: found the inspiring link on a turkish forum ala google and google translate.

    -wigout
    Last edited by wigout; 04-03-2010 at 06:46 AM.

  2. #2
    Join Date
    Dec 2009
    Location
    ON, Canada
    Posts
    4,905

    Thumbs up Great post ..

    I am guessing you are on a roll today
    Keep them coming man.

  3. #3
    Join Date
    Mar 2010
    Posts
    16

    Default

    I assume you did this under P02?

  4. #4
    Join Date
    Feb 2010
    Posts
    638

    Default

    No, it's under firmware 04.

  5. #5
    Join Date
    Feb 2010
    Posts
    638

    Default

    So changes made to the smb.conf persist for what seem like about 1 day. Then they get overwritten.

    As I often reboot/powerdown my pbo, it's not a big deal.

    But I wanted to understand what was happening. So I looked into the configsamba file (of foxeye's mod fame) to see what goodness it did.

    I think it's the key. I think it periodically is retriggered to write the smb.conf anew. (I don't understand under what circumstances configsamba is rerun).

    Anyway, as I want the root to mount with out much funny business, I simply added the lines I wanted in the smb.conf files to the configsamba file- which then echoes my additions to the smb_user.conf and smb_anonymous.conf files.

    But wait a minute, my slow brain eventually asked- why isn't the configsamba adding to the smb.conf file? However will my changes end up in the smb.file?

    The key is in the
    /tmp/package/script/samba-security anonymous
    command at the end of the script.

    Code:
    / # cat /tmp/package/script/samba-security
    #!/bin/sh
    #
    # description: modify the samba security level
    
    
    anonymous() {
            cp -f /tmp/package/samba/lib/smb_anonymous.conf /tmp/package/samba/lib/smb.conf
            RETVAL=$?
            echo
            return $RETVAL
    }
    
    user() {
            echo -e "123\n123" >/usr/local/etc/dvdplayer/tmpfile_samba
            /tmp/package/samba/sbin/smbpasswd -a admin -s</usr/local/etc/dvdplayer/tmpfile_samba >/dev/null 2>&1
            rm -f /usr/local/etc/dvdplayer/tmpfile_samba
            cp -f /tmp/package/samba/lib/smb_user.conf /tmp/package/samba/lib/smb.conf
            RETVAL=$?
            echo
            return $RETVAL
    }
    
    case "$1" in
      anonymous)
            anonymous
            ;;
      user)
            user
            ;;
      *)
            echo $"Usage: $0 {anonymous|user}"
            exit 1
    esac
    
    exit $?
    / #
    Following the script along, we find that the "samba-security" script has been invoked with the "anonymous" option, so the smb_anonymous.conf is then written over onto the /tmp/package/samba/lib/smb.conf file.



    So here's the improved process and code:
    On Firmware 4, you will have to free up some memory so you can make symbolic links and such- follow the instructions "Custom Root Partition Size" or face the dreaded memory allocation error.

    Then:
    Code:
    cd /usr/local/etc/
    touch configsamba
    chmod +x configsamba
    Open up configsamba with vi, copy and paste the code below:

    Code:
    #!/bin/sh
    #
    # description: create the samba conf file
    
    # if smb.conf already exist,nothing need to be done
    #if [ -e /tmp/package/samba/lib/smb.conf ]
    #then
    #   echo "smb conf already exist"
    #   exit 0
    #fi
    
    if [ -d /tmp/smb ]
    then
        echo ""
    else
        mkdir /tmp/smb
    fi
    
    cp /tmp/package/samba/conf/smb_anonymous_head.conf /tmp/package/samba/lib/smb_anonymous.conf
    cp /tmp/package/samba/conf/smb_user_head.conf /tmp/package/samba/lib/smb_user.conf
    
    str=$(ls /tmp/ramfs/volumes/)
    cd /tmp/ramfs/volumes/
    
    if [ $# -gt 0 ]
    then
        str=$(ls $1)
        cd $1
    fi
    
    for i in $str
    do
        path=$(readlink -f $i)
        echo $path
        mountpoint=$(cat /proc/mounts|grep $path |cut -d" " -f 2)
        carrier=$(cat /sys/class/net/eth0/carrier)
        echo $carrier
    
        if [ $# -gt 1 ]
        then
                mount -o remount,$2 $mountpoint
                echo "remount $2"
        else
            if [ -f /sys/class/net/eth0/carrier ] && [ $(cat /sys/class/net/eth0/carrier) -eq 1 ]
            then
                echo "remount rw"
                mount -o remount,rw $mountpoint
            else
                if [ -f /sys/class/net/wlan0/carrier ] && [ $(cat /sys/class/net/wlan0/carrier) -eq 1 ]
                then
                    echo "remount rw"
                    mount -o remount,rw $mountpoint
                else
                    echo "remount ro"
                    mount -o remount,ro $mountpoint
                fi
            fi
        fi
    
    # || [ -f /sys/class/net/wlan0/carrier ] && [$(cat /sys/class/net/wlan/carrier | echo) -eq '1' ];
        sharename=$(echo $i | cut -d":" -f 1)
        echo $sharename
        echo "[$sharename]" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "path=$mountpoint" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "hide dot files=yes" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "hide files=/.*/lost+found/">>/tmp/package/samba/lib/smb_anonymous.conf
        echo "guest ok=yes" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "writable=yes " >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "force create mode=0775 " >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "force directory mode=0775 " >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "[$sharename]" >>/tmp/package/samba/lib/smb_user.conf
        echo "path=$mountpoint" >>/tmp/package/samba/lib/smb_user.conf
        echo "hide dot files=yes" >>/tmp/package/samba/lib/smb_user.conf
        echo "hide files=/.*/lost+found/">>/tmp/package/samba/lib/smb_user.conf
        echo "guest ok=no" >>/tmp/package/samba/lib/smb_user.conf
        echo "writable=yes " >>/tmp/package/samba/lib/smb_user.conf
        echo "force create mode=0775 " >>/tmp/package/samba/lib/smb_user.conf
        echo "force directory mode=0775 " >>/tmp/package/samba/lib/smb_user.conf
    done
    
    #Start show root partition edits
        echo "[root]" >>/tmp/package/samba/lib/smb_user.conf
        echo "path=./" >>/tmp/package/samba/lib/smb_user.conf
        echo "hide dot files=no" >>/tmp/package/samba/lib/smb_user.conf
        echo "hide files=/.*/lost+found/">>/tmp/package/samba/lib/smb_user.conf
        echo "guest ok=yes" >>/tmp/package/samba/lib/smb_user.conf
        echo "writable=yes " >>/tmp/package/samba/lib/smb_user.conf
        echo "force create mode=0775 " >>/tmp/package/samba/lib/smb_user.conf
        echo "force directory mode=0775 " >>/tmp/package/samba/lib/smb_user.conf
        echo "[root]" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "path=./" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "hide dot files=no" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "hide files=/.*/lost+found/">>/tmp/package/samba/lib/smb_anonymous.conf
        echo "guest ok=yes" >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "writable=yes " >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "force create mode=0775 " >>/tmp/package/samba/lib/smb_anonymous.conf
        echo "force directory mode=0775 " >>/tmp/package/samba/lib/smb_anonymous.conf
    #End show root partition edits
    
    /tmp/package/script/samba-security anonymous
    exit 0
    Then:

    Code:
    mv /usr/local/bin/package/script/configsamba  /usr/local/etc/configsamba_bak
    ln -s /usr/local/etc/configsamba /usr/local/bin/package/script/
    reboot and enjoy perpetual access to your pbo's root partition over the network.
    Last edited by wigout; 04-15-2010 at 07:29 PM.

  6. #6
    Join Date
    Dec 2009
    Location
    Johannesburg, South Africa
    Posts
    79

    Default

    Ah, some lovely work here wigout.
    Its inspired me to try implement my script back onto th P04 (that is to say the scripts that add the usb drives and some server shares to the HDD menu)

  7. #7
    Join Date
    Jul 2010
    Location
    Pennsylvania, USA
    Posts
    12

    Default Let's Save Playlists to The Network!

    I'm surprised no one has posted how to mount the "internal" HDD from the network. I do have several NFS mounts, but they don't accept the Playlists because they are not where the PBO software expects the internal drive to be.

    Has anyone figured out how to set up the links so the Playlists can be on a network share?

    Isn't this a case of mounting root as rw, creating a link from the /dev/sda to /usr/local/etc/sda, remounting root ro, and then mounting something on the writable spot?

  8. #8
    Join Date
    Feb 2010
    Location
    Round Rock TX
    Posts
    1,076

    Default

    This breaks every rule of linux security but since it's embedded and a media device it's quite ok to do this and I'll use this option for when I build the project I'm doing as it will sure cut out a lot of time hacking up how it loads and boots with ease of cutting and pasting into the root filesystem. wigout you're linux thirsty and doing a great job learning and so nice to see someone excited about learning the OS I truly love and have played with for 10 yrs now.

  9. #9
    Join Date
    Jul 2010
    Location
    Pennsylvania, USA
    Posts
    12

    Default Mounting /dev/hda for Playlists

    Not sure I agree with the security comment, if that was for me, but if someone could post what their internal drive mount looks like and where their Playlist resides, I'll be happy to implement that as a network storage mount. Thanks.

  10. #10
    Join Date
    Jun 2011
    Posts
    1

    Default

    Hi,

    Is this hack still valid / works with P70R2 or P70R2mega?

    thanks

    jdc

Tags for this Thread

Posting Permissions

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