NSLU2-Linux
view · edit · print · history

Change your Shell using .profile

You might want to see HowTo.RunAnotherShellForRootSafely instead.

Requires:

  • Unslung firmware and drive
  • newer version of busybox

Steps:

  • create /root directory (probably aready did this if you use dropbear to login)
  • create /root/.profile (I actally created it as .login with a symlink to .profile)
  • chmod 755 /root/.profile
  • add commands to .profile to be executed on login
#!/bin/sh
export PATH=$PATH:/my/dir
/opt/bin/sh
alias l='ls -la'
alias c='cd ..'
  • logout
  • login and verify that you are now in the new shell(double-shelled, but it works)

An alternative (although dangerous one) is to change your shell in the /etc/passwd file. This may require the creation of an /etc/shells file that lists the new shell, but I haven't tested this to know for sure.

heath

  • if you create an /etc/shells and insert the following line:

/opt/bin/sh you will be able to edit your shell in /etc/passwd as follows: root:3Na3KhotdogAM:0:0:root:/root:/opt/bin/sh and still be able to log in...

greg lawler

  • Another way to do this and also avoid double-shelling is to use exec, I simple have this in my .profile
test -x /opt/bin/bash && exec /opt/bin/bash

kolla

view · edit · print · history · Last edited by tlhackque.
Based on work by tlhackque, jake, kolla, greg lawler, and heath.
Originally by heath.
Page last modified on March 30, 2008, at 07:51 PM