Shell queries

Is there an easy way to make something like this persistent when telnetted in to the Humax?
Code:
humax# alias scp="scp -i /mod/.ssh/db_rsa"
humax# alias
scp='scp -i /mod/.ssh/db_rsa'
This only lasts for the instance of "sh" you are running.

As an alternative to a shell alias, you could put this /mod/.ssh/config:
Code:
IdentityFile /mod/.ssh/db_rsa
although that would also affect ssh, as well as scp, which may or may not be what you want.

An advantage of putting it in the config file would be to control its application, e.g. restrict it to particular host(s):
Code:
Host server1 server2 server3
 IdentityFile /mod/.ssh/db_rsa
 
It would be nice and ssh/scp is exactly what I wanted to do, but I don't think Dropbear supports a config. file.
 
Code:
# Stuff for both shells
alias ls='ls -CFh'

if [ "$0" = '-sh' -o "$0" = '/bin/sh' ]; then
     # If in the default login shell and the better one is available, then...
     [ -x /mod/bin/busybox/sh ] && exec /mod/bin/busybox/sh -l
else
     # Things to run in the better shell only.
     export PS1="\[\033[01;32m\]\h\[\033[01;34m\] \w \# \[\033[00m\]"
fi
I've just discovered the flaw with this... in maintenance mode you are running the shell from /mod/bin/busybox so can't unmount /dev/sda2
 
I've just discovered the flaw with this... in maintenance mode you are running the shell from /mod/bin/busybox so can't unmount /dev/sda2
This should fix it.
Code:
# Stuff for both shells
alias ls='ls -CFh'
if [ "$0" = '-sh' -o "$0" = '/bin/sh' ]; then
   # If in the default login shell and not maint mode and the better one is available then...
   if [ ! -f /tmp/maintenance.boot.log ]; then
     [ -x /mod/bin/busybox/sh ] && exec /mod/bin/busybox/sh -l
   fi
else
  # Things to run in the better shell only.
  export PS1="\[\033[01;32m\]\h\[\033[01;34m\] \w \# \[\033[00m\]"
fi
 
Last edited:
I added:
Code:
export SHELL=/mod/bin/busybox/sh
to the "else" clause and now it also works properly when shelled out from FTP (using the "!" command). Previously it ran the wrong shell (/bin/sh) and thus gave me a literal prompt of all that colour/path/host stuff.
 
Also added:
Code:
alias rsync='rsync -e='"'"'ssh -i /mod/.ssh/db_rsa'"'"
so rsync now works properly as well!
 
Last edited:
Current version is now:
Code:
# Stuff for both shells
alias rsync='rsync -e='"'"'ssh -i /mod/.ssh/db_rsa'"'"
alias scp='scp -i /mod/.ssh/db_rsa'
alias ssh='ssh -i /mod/.ssh/db_rsa'

if [ "`echo $0 | cut -d/ -f4`" = busybox ]; then
  # Things to run in the better shell only.
  export PS1="\[\033[01;32m\]\h\[\033[01;34m\] \w \# \[\033[00m\]"
  export SHELL=/mod/bin/busybox/sh
else
  # If in the default login shell and not maint mode and the better one is available, then...
  if [ ! -f /tmp/maintenance.boot.log ]; then
    [ -x /mod/bin/busybox/sh ] && exec /mod/bin/busybox/sh -l
  fi
fi
following further discussion in the Webshell thread.
 
Last edited:
Back
Top