What's new

Permission denied on several scripts

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

kha

New Around Here
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'
 
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'
 
Does someone knows why bash did not work for me ? Also is there another URL I can set to make ipkg update work ?
 
That error message is normal. Asus doesn't have a fully working optware repo, so there's no Packages.gz file.
 
And for the bash install not working properly, do you have an idea ?

No idea, you only posted logs of the ipkg update, not of the bash install attempt.
 
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
 
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 $.
 
Similar threads
Thread starter Title Forum Replies Date
P All of a sudden DHCP denied messages in Windows logs Asuswrt-Merlin 5

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top