Notices


Reply
Thread Tools
Posts: 2 | Thanked: 0 times | Joined on Nov 2010
#21
Cheers, works perfectly! Just change the /etc/passwd, no need to symlink as that might break stuff
 
Posts: 152 | Thanked: 58 times | Joined on Oct 2010 @ void
#22
Thanks for the tip and package! Bash is one of the most important features I need.

Running as user I can use bash with colors by editing .bashrc, but as root the shell falls back to busybox e.g. ls is busybox's and cannot recognize options like --color=auto and accept alias.

To solve this, I have to (as root):
1. copy these few lines from .bashrc to /etc/profile:
export LS_OPTIONs='--color=auto'
eval "`dircolors'"
alias ls='ls $LS_OPTIONS'
alias ls='ls $LS_OPTIONS -l'
alias ls='ls $LS_OPTIONS -la'

2. edit /etc/passwd
Not only "root" and "user", but "bin" also has to use "/bin/bash".

On top of that, it makes life easier to me to login as root in /home/user rather than /root. so in "root" /home/user (the second last item in "root") becomes the default dir.
Attached Images
 

Last edited by 009N; 2010-11-30 at 06:56. Reason: added screenshot
 

The Following User Says Thank You to 009N For This Useful Post:
Posts: 284 | Thanked: 320 times | Joined on May 2010 @ Peterborough, UK
#23
Thanks for the guidelines, though I had to do things a little differently myself.

Firstly, for dircolors to work, coreutils-gnu has to be installed - from titan, who else http://maemo.org/packages/view/coreutils-gnu/

Once this is installed, then there are two options; either add /usr/bin/gnu to the PATH in /etc/profile (but ensure it is the first entry), or alias ls to use gls, so that the lines mentioned (which had a couple of typos) read:

Code:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='gls $LS_OPTIONS'
alias ll='gls $LS_OPTIONS -l'
alias l='gls $LS_OPTIONS -la'
I prefer the former method, as then you get the proper gnu versions of tar, dir, uname and many others, rather than the crippled busybox ones. Using this I also found that changing bin's shell to /bin/bash was unnecessary but YMMV.

Finally, I needed to add /sbin and /usr/sbin to the PATH in /etc/profile too as they are not there by default, but are in rootsh - talking of which, /usr/sbin/gainroot has to be changed for "sudo gainroot" to work, so that it uses /bin/bash and also .bash_history rather than .ash_history. It's a one-line change and really straightforward but I can post it if anyone is stuck.

Last edited by Tigerite; 2010-12-01 at 10:22.
 

The Following User Says Thank You to Tigerite For This Useful Post:
Straycat's Avatar
Posts: 218 | Thanked: 59 times | Joined on Feb 2010 @ spain
#24
Originally Posted by Tigerite View Post
...

Finally, I needed to add /sbin and /usr/sbin to the PATH in /etc/profile too as they are not there by default, but are in rootsh - talking of which, /usr/sbin/gainroot has to be changed for "sudo gainroot" to work, so that it uses /bin/bash and also .bash_history rather than .ash_history. It's a one-line change and really straightforward but I can post it if anyone is stuck.
Please...

Thanks in advance.
 
Posts: 284 | Thanked: 320 times | Joined on May 2010 @ Peterborough, UK
#25
Okay as root, use an editor of your choice (personally mine is nano) and change

Code:
else
  echo 'Root shell enabled'
  HISTFILE=/root/.ash_history /bin/sh
fi
to

Code:
else
  echo 'Root shell enabled'
  HISTFILE=/root/.bash_history /bin/bash
fi
That's it
 

The Following 2 Users Say Thank You to Tigerite For This Useful Post:
Posts: 284 | Thanked: 320 times | Joined on May 2010 @ Peterborough, UK
#26
Sorry, forgot to add that the PATH needs changing in the gainroot script too, so that /usr/bin/gnu is in it as in /etc/profile. It would also need to be the first entry if you want the gnu executables to replace the busybox defaults.
 
Posts: 152 | Thanked: 58 times | Joined on Oct 2010 @ void
#27
I am trying your method and have done these, but the shell (echo $SHELL)is still using busybox (/bin/sh), although gls /w colors is working.
  1. Installed coreutils-gnu
  2. In /etc/profile: export PATH="/usr/bin/gnu:/sbin:/usr/sbin:/bin:/usr/bin..."
  3. In /usr/sbin/gainroot: /usr/bin/gnu is the first in PATH; and HISTFILE=/root/.bash_history /bin/bash

Resource /etc/profile or reboot didn't change anything.
 
Posts: 284 | Thanked: 320 times | Joined on May 2010 @ Peterborough, UK
#28
I'm guessing you still have the entries in /etc/passwd so that user and root are using /bin/bash as shell (they're still required, of course)? If so then I'm stumped as to why it would default to /bin/sh..
 
Reply


 
Forum Jump


All times are GMT. The time now is 04:49.