Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Permission denied on several scripts

Discussion in 'Asuswrt-Merlin' started by kha, Feb 21, 2013.

  1. kha

    kha New Around Here

    Joined:
    Feb 21, 2013
    Messages:
    5
    Hello,

    This morning I logged onto my RT-N66U with latest Merlin firm. (Firmware Version:3.0.0.4.270.24 (Merlin build)) to check crontabs.

    I ran:

    Code:
    cru l
    and got:

    Code:
    [kha@RT-N66U root]$ cru l
    /usr/sbin/cru: line 4: nvram: Permission denied
    Line 4 is:

    Code:
    F="$D/`nvram get http_username`"
    If i run it it works:

    Code:
    [kha@RT-N66U root]$ nvram get http_username
    kha
    It's like the interpreter does not work... Yetserday I installed through ipkg packages bash, bash-completion and core-utils... I am wondering what can cause this issue: when runnign scripts, it's like the interpreter does not have any right to run binaries...

    i also tried to run

    Code:
    ipkg update 
    but got:

    Code:
    [kha@RT-N66U root]$ ipkg update
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
    sh: wget: Permission denied
    Downloading http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz
    sh: wget: Permission denied
    An error ocurred, return value: 2.
    Collected errors:
    ipkg_download: ERROR: Command failed with return value 127: `wget    -q -P /opt/ipkg-CQBWnZ http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz'
    ipkg_download: ERROR: Command failed with return value 127: `wget    -q -P /opt/ipkg-CQBWnZ http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz'
     
  2. kha

    kha New Around Here

    Joined:
    Feb 21, 2013
    Messages:
    5
    I removed bash-completion and bash package and cru now works.

    But ipkg update till cannot download some packages:

    Code:
    kha@RT-N66U:/tmp/home/root# ipkg update
    Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
    Inflating http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
    Updated list of available packages in /opt/lib/ipkg/lists/optware.oleg
    Downloading http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz
    wget: server returned error: HTTP/1.1 404 Not Found
    An error ocurred, return value: 1.
    Collected errors:
    ipkg_download: ERROR: Command failed with return value 1: `wget    -q -P /opt/ipkg-YTYTJ0 http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz'
     
  3. kha

    kha New Around Here

    Joined:
    Feb 21, 2013
    Messages:
    5
    Does someone knows why bash did not work for me ? Also is there another URL I can set to make ipkg update work ?
     
  4. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    18,195
    Location:
    Canada
    That error message is normal. Asus doesn't have a fully working optware repo, so there's no Packages.gz file.
     
  5. kha

    kha New Around Here

    Joined:
    Feb 21, 2013
    Messages:
    5
    And for the bash install not working properly, do you have an idea ?
     
  6. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    18,195
    Location:
    Canada
    No idea, you only posted logs of the ipkg update, not of the bash install attempt.
     
  7. nobode

    nobode Occasional Visitor

    Joined:
    May 12, 2013
    Messages:
    12
    After installing bash, the prompt changed from # to $, indicating a loss of root privilege.

    It's a optware-related issue, because a long time ago when I use TomatoUSB I had the same problem, and I solved it by editng some file like /opt/etc/profile, but I don't remember exactly nor how, nether can I google anything out today. Waiting for a solution.

    Here is how to reproduce the issue:

    1. Make a clean install of optware. Can be done by installing Asus DownloadMaster and then uninstall it.

    2. telnet/ssh to router, you will be prompted with a # and no problem.

    3. ipkg install bash, then exit the telnet/ssh session.

    4. re-telnet/ssh, you'll be prompted with a $, root privilege lost.

    5. umount the optware device. re-telnet/ssh, you gain root again, no problem.

    6. telnet/ssh after optware device mounted, you lost root.

    Appreciate a solution
     
  8. nobode

    nobode Occasional Visitor

    Joined:
    May 12, 2013
    Messages:
    12
    I got it. Edit /opt/etc/profile
    change this line
    LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}
    to
    LD_LIBRARY_PATH=/lib:/opt/lib:${LD_LIBRARY_PATH}

    Problem solved. So it's a lib path search order issue.

    BTW, the PS1 should end with \$, instead of $, otherwise always shows $.
     

Share This Page