NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
eton
May 18, 2015Luminary
RAIDiator 4.1.14 changed bash shell behaviour - Bug?
RAIDiator version 4.1.14 changed bash's shell behaviour. Bug or new features?
Example of executing bulkGetter script as user UserName under RAIDiator version 4.1.13 (Sparc):
After updating to 4.1.14 I am not able to run scripts/programs as a different user than root.
Executing the bash script above under 4.1.14, outputs the message: "sh: line 1: bulkGetter.sh: command not found".
And I've tried with different syntaxes for su, but still no luck. Yes, the path works and I can run the script as root. And the script is stored in /root/bin and moving it to /usr/local/bin didn't change anything.
Example of executing bulkGetter script as user UserName under RAIDiator version 4.1.13 (Sparc):
# su -c "bulkGetter.sh downloadlist.txt . -rm" -s /bin/sh UserName
After updating to 4.1.14 I am not able to run scripts/programs as a different user than root.
4. Updated bash to fix "ShellShock" vulnerability.
5. Fixed additional bash vulnerabilities.
Executing the bash script above under 4.1.14, outputs the message: "sh: line 1: bulkGetter.sh: command not found".
And I've tried with different syntaxes for su, but still no luck. Yes, the path works and I can run the script as root. And the script is stored in /root/bin and moving it to /usr/local/bin didn't change anything.
12 Replies
Replies have been turned off for this discussion
- mdgm-ntgrNETGEAR Employee RetiredThat script is not listed as executable. Also is the shell enabled for the User? By default ordinary users the bin is set to false.
- etonLuminary
mdgm wrote: That script is not listed as executable. Also is the shell enabled for the User? By default ordinary users the bin is set to false.
Of curse it's listed as executable, -rwxr-xr-x (755). I wrote that I could run it under 4.1.13 and earlier as any user and that I can still run it as root. Or do you refer to something other type of listing?
Ah, you might have misunderstood my code example above. The file listed from ls is just a example of a downloaded file from the script, not the script it self. - mdgm-ntgrNETGEAR Employee RetiredWhat is the shell set to for the user you are trying to run the script as? Is it set to /bin/false or something else?
- etonLuminary
mdgm wrote: What is the shell set to for the user you are trying to run the script as? Is it set to /bin/false or something else?
I found this:# cat /etc/passwd
UserName:HashedPass:1002:100:user.name@server.com:/c/home/username:/bin/false
But I have never changed anything there before AND I could run the script as a different user prior to RAIDiator 4.1.14.
(To avoid misunderstandings I also removed the "ls -la" line in the first post.) - mdgm-ntgrNETGEAR Employee RetiredWell if you change the shell
# chsh -s /bin/bash UserName
is the script then able to run? - etonLuminary
mdgm wrote: Well if you change the shell
# chsh -s /bin/bash UserName
is the script then able to run?
Thanks. Though this might not be the problem. I am getting the same errors with both /bin/bash and /bin/false.# su -c "bulkGetter.sh downloadlist.txt . -rm" -s /bin/sh UserName
sh: line 1: bulkGetter.sh: command not found
But bash finds the script when I specify full path:# su -c "/usr/local/bin/bulkGetter.sh downloadlist.txt . -rm" -s /bin/sh UserName
./FileToDownload.zip: Permission denied
There seem to be some problems with PATH variables in RAIDiator 4.1.14. My script is located in "/usr/local/bin/" but bash can't find it for UserName without giving it the full path. But PATH works fine for root. Both these works for root, but I want to run the script as a different user :( It used to work just fine until 4.1.14.# /usr/local/bin/bulkGetter.sh downloadlist.txt . -rm
# bulkGetter.sh downloadlist.txt . -rm - mdgm-ntgrNETGEAR Employee Retired
It's the same as it's always been. If the user you're su`ing
to has a .bashrc that redefines $PATH to include your chosen path, then
it will work. If not, $PATH will come from /etc/login.defs, which does
not, and has never (at least in the past 7 years, which is as far back
as I looked), included /usr/local/bin - etonLuminary
mdgm wrote: It's the same as it's always been. If the user you're su`ing to has a .bashrc that redefines $PATH to include your chosen path, then
it will work. If not, $PATH will come from /etc/login.defs, which does not, and has never (at least in the past 7 years, which is as far back as I looked), included /usr/local/bin
My PATH config. And I have never touched /etc/login.defs.
# cat ~/.bashrc
export PATH="$PATH:$HOME/bin"
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/root/bin
Same problem after I moved bulkGetter.sh to ~/bin. - mdgm-ntgrNETGEAR Employee RetiredIt's not root's $PATH you want to change.
If you look at /etc/passwd you will see the path to the home directory for the user. You need a .bashrc file in that directory. - etonLuminary
mdgm wrote: It's not root's $PATH you want to change.
If you look at /etc/passwd you will see the path to the home directory for the user. You need a .bashrc file in that directory.
This doesn't seem to be the problem and it worked before. Now I tried to move the script to the UserName path in /etc/passwd. Same result as before (, as I expected). There is something wrong with handling of PATHs in RAIDiator 4.1.14.# su -c "bulkGetter.sh downloadlist.txt . -rm" -s /bin/sh UserName
sh: line 1: bulkGetter.sh: command not found
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!