Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

BusyBox

  • 12-11-2009 1:50am
    #1
    Moderators, Education Moderators, Home & Garden Moderators Posts: 8,260 Mod ✭✭✭✭


    Hi,

    I'm trying to edit the HOSTS file hidden in my Voyager 2110 router so that I don't have to keep typing the IP of each computer on the LAN.

    Problem is that the router is running a very lean version of BusyBox with hardly any cmds left.
    BusyBox v1.00 (2007.03.26-10:54+0000) Built-in shell (msh)
    Enter 'help' for a list of built-in commands.
    
    # help
    
    Built-in commands:
    -------------------
            . : break cd continue eval exec exit export help login newgrp
            read readonly set shift times trap umask wait [ busybox cat chmod
            date df dmesg echo expr false ifconfig init insmod kill klogd
            linuxrc ln logger logread mkdir mount msh ping ps pwd reboot
            rm rmmod route sendarp sh sysinfo syslogd test tftp tftpd top
            true tty vconfig
    
    #
    
    Can anyone spot at way to edit a file using those cmds above? Seems like an awful effort to recompile from source each time I want to edit the filesystem.


Comments

  • Closed Accounts Posts: 6,151 ✭✭✭Thomas_S_Hunterson


    echo "192.168.1.3      mycomputer" >> hosts
    
    Should do it.

    Using >> appends the output to a new line in the file. If you want to clear it and start afresh, use >.


  • Registered Users, Registered Users 2 Posts: 2,755 ✭✭✭niallb


    Another approach:

    cat >> newhosts

    Press enter and type in your hosts file as you want it.
    When you're finished, press enter for an empty line and press CTRL-D
    this should give you your prompt back.

    cat newhosts

    and check to see the temporary file looks right.
    If it is, then cp newhosts /etc/hosts to put it in place.

    If you've a few different hosts to put in, this approach might be easier.

    (Another tip for borked systems, if ls isn't working, echo *
    will work as a crude subsitute... There's more...)


  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,260 Mod ✭✭✭✭Jonathan


    Sean_K wrote: »
    echo "192.168.1.3      mycomputer" >> hosts
    
    Should do it.

    Using >> appends the output to a new line in the file. If you want to clear it and start afresh, use >.
    Yeah, I had saw that during my googles, but would have been more comfortable editing the file proper, rather than appending to it.
    niallb wrote: »
    Another approach:

    cat >> newhosts

    Press enter and type in your hosts file as you want it.
    When you're finished, press enter for an empty line and press CTRL-D
    this should give you your prompt back.

    cat newhosts

    and check to see the temporary file looks right.
    If it is, then cp newhosts /etc/hosts to put it in place.

    If you've a few different hosts to put in, this approach might be easier.

    (Another tip for borked systems, if ls isn't working, echo *
    will work as a crude subsitute... There's more...)
    That was more along the lines of what I was looking for thanks.


    In the end it doesn't anyway. I've just realised all the files are replaced when the system is rebooted. :(


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Jonathan wrote: »
    Yeah, I had saw that during my googles, but would have been more comfortable editing the file proper, rather than appending to it.

    That was more along the lines of what I was looking for thanks.


    In the end it doesn't anyway. I've just realised all the files are replaced when the system is rebooted. :(

    There must be a way of mounting the partitions(s) as non read only
    during boot. BT may have locked the thing down quite well considering
    its a consumer device.

    If not, you could just write out a decent /etc/hosts on your main machine
    and just rsync/scp it to other boxes in the network.


  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,260 Mod ✭✭✭✭Jonathan


    Naikon wrote: »
    There must be a way of mounting the partitions(s) as non read only
    during boot. BT may have locked the thing down quite well considering
    its a consumer device.

    If not, you could just write out a decent /etc/hosts on your main machine
    and just rsync/scp it to other boxes in the network.
    I forgot to reply to this.

    Yeah, I didn't want to go editing the local hosts file as one of them is a laptop (on the off chance that another computer on a different network that the laptop might connect to would have a computer with the same host name).


  • Advertisement
  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Jonathan wrote: »
    I forgot to reply to this.

    Yeah, I didn't want to go editing the local hosts file as one of them is a laptop (on the off chance that another computer on a different network that the laptop might connect to would have a computer with the same host name).

    Makes sense. Hope you get sorted out:)


Advertisement