Nano in chroot ssh jail

Asked by Brandon McGlumphy

I created a chroot jail for SSH. I downloaded a script that autocreates a jail in /home/jail/home/user but it didnt copy over Nano. I copied Nano from /bin/ into /home/jail/bin/ but when I try to load it I get this error:

nano: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory

The libncurses is in /home/jail/lib/ but do I need to do something else to get Nano to work in the jail?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Dario Teixeira (darioteixeira) said :
#1

First point: did you run "ldd `which nano`" to be sure you copied into the jail *all* the libraries that nano depends upon?

As the second step, I would make that the libraries copied into the jail correspond faithfully to the structure normally found in /usr/lib. Did you create the proper symlinks, for example?

Revision history for this message
Brandon McGlumphy (brandonmcglumphy) said :
#2

All I did was 'cp /bin/nano /home/jail/bin'. Didnt realize there was more to it.

I just did ldd nano and here's what it spits out:

linux-gate.so.1 => (0xffffe000)
        libncursesw.so.5 => /lib/libncursesw.so.5 (0xb7ea2000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7d58000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7d54000)
        /lib/ld-linux.so.2 (0xb7f05000)

Think you could give me some steps as to what to do?

Revision history for this message
Kris Marsh (moogman) said :
#3

Hi,

You will need to basically copy some of the files such that nano can find the files in the directories it expects. Assuming your jail is set to /home/jail, you will need the following:

/home/jail/lib/linux-gate.so.1
/home/jail/lib/libncursesw.so.5
/home/jail/lib/tls/i686/cmov/libc.so.6
/home/jail/lib/tls/i686/cmov/libdl.so.2
/home/jail/lib/ld-linux.so.2

Give nano another go then, and if that doesn't work, see what output you get from ldd (and possibly repeat the above process).

Can you help with this problem?

Provide an answer of your own, or ask Brandon McGlumphy for more information if necessary.

To post a message you must log in.