1

When I run telnetd -l /bin/sh on an embedded Linux device and use Putty to telnet to it, the provided shell is /bin/psh (protected shell).

On this device, /bin/sh is a symbolic link to /bin/busybox.

Where I can see on this system that /bin/sh redirects to /bin/psh?

How can I change it if /bin is read only?

3
  • 1
    Maybe the user's shell is set to /bin/psh in /etc/passwd? Jan 26, 2020 at 19:18
  • @multithr3at3d no. There is /bin/sh
    – Meryy
    Jan 27, 2020 at 20:20
  • @Meryy that's not the point. The point was whether the user is configured to use /bin/psh when logging in. That is, /etc/passwd has the shell set that way (see chsh on full-blown systems). Typically your alternative shells will also have to be in /etc/shells so as to be eligible as login shells.
    – 0xC0000022L
    Mar 3, 2021 at 9:32

1 Answer 1

1

First you can ask where the shell lies with which sh. The command tells the full path.

Then, you can use ls - al to view whether or not that is a symbolic link on its own or not.

Once you have found the original shell you know whether or not it fits your need.

To change the shell for the user you are using, you have plenty of choices, depending on whether or not you are root. Have a look here to have an idea.

If, instead, you want to change where the symbolic link points, you can you have to be root and use the ln command. Keep in mind that changing the shell in this way can have serious unwanted consequences.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.