NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

zennit's avatar
zennit
Aspirant
Nov 09, 2011

su bash problems

Hi Guys, I've just setup a new ssh user using this guide

viewtopic.php?f=36&t=25327

When I logged in and tried some commands is was getting:

bash: ls: command not found

So I changed /etc/passwd sshd from /bin/false to /bin/bash , and that seemed to give my bash commands back? not sure why maybe someone could explain.

Now the problem is when I su to root I get the same problem.

Any ideas?


Is it something to do with this

http://idratherhack.blogspot.com/2011/0 ... en-su.html

In order to get git working I did the following

so on my ReadyNAS, I modified the .bashrc file to include /opt/rfw/bin:

readynas:~# cat .bashrc


# ~/.bashrc: executed by bash(1) for non-login shells.

PATH=:$PATH:/opt/rfw/bin
export PATH

export PS1='\h:\w\$ '
umask 022

http://geekswithblogs.net/EltonStoneman ... dynas.aspx

Would this have anything to do with it?

9 Replies

Replies have been turned off for this discussion
  • i also noticed in /etc/passwd root has this path

    .:0:0:root:/root:/bin/bash

    and my user has

    :1007:100::/c/home/z:/bin/bash

    related to the problem?
  • mdgm-ntgr's avatar
    mdgm-ntgr
    NETGEAR Employee Retired
    Your /etc/passwd file is fine, I think. Is this on a x86 ReadyNAS (e.g. NVX/Ultra/Pro)? If so, the encrypted password is stored in /etc/shadow which would explain why you don't see the encrypted password in that file that you'd expect from looking at the Duo (v1)

    As NetGear intends SSH access only to be used by the "root" user it's stripped out all the other stuff it sees as unnecessary to keep the firmware image as small as possible.

    As for your su problem I don't know.

    Have you considered editing /etc/sudoers and using sudo?
  • its the duo, the password is there I just didn't paste
  • I'm just worried about closing my ssh session because as it stands with root access off, if i login as a user and su to root bash doesnt seem to work and all the commands I run when In su get a command not found
  • mdgm-ntgr's avatar
    mdgm-ntgr
    NETGEAR Employee Retired
    Re-enable root access for now then. Is there a reason why you'd like to do it via "su" rather than simply using the root user with a strong password?
  • because i'm accessing the nas from the web via ssh, and I guess it's just best practice to block root
  • ok when i'm logged in as root i tried the following cmd

    echo $PATH

    /opt/rfw/bin:/opt/rfw/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

    when logged in as a user i get

    /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More