LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-12-2008, 01:07 PM   #1
bambeklis
Member
 
Registered: Aug 2005
Posts: 58

Rep: Reputation: 15
chroot (libncurses.so.5: cannot open shared object)


Hi,

ist:/usr/lib# chroot /home/jail/ /bin/bash
/bin/bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: Error 40
ist:/usr/lib#

howto fix it?

thank you
 
Old 06-12-2008, 01:12 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Copy the dependent libraries inside the jail?
 
Old 06-12-2008, 01:15 PM   #3
bambeklis
Member
 
Registered: Aug 2005
Posts: 58

Original Poster
Rep: Reputation: 15
I've already copied them...still not working
 
Old 06-12-2008, 05:14 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
You probably have to add the libraries within your jail to your LD_LIBRARY_PATH. Try:

echo $LD_LIBRARY_PATH

-------------------
Steve Stites
 
Old 06-13-2008, 03:15 AM   #5
bambeklis
Member
 
Registered: Aug 2005
Posts: 58

Original Poster
Rep: Reputation: 15
ist:~# echo $LD_LIBRARY_PATH

ist:~# chroot /home/jail/ /bin/bash

Still not working...
 
Old 06-13-2008, 01:10 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Add the libraries that you copied inside the jail to your LD_LIBRARY_PATH

-----------------------
Steve Stites
 
Old 06-14-2008, 05:28 AM   #7
bambeklis
Member
 
Registered: Aug 2005
Posts: 58

Original Poster
Rep: Reputation: 15
How to do that ?

chroot.sh:

#!/bin/bash

export LD_LIBRARY_PATH=/usr/lib/libncurses.so.5:$LD_LIBRARY_PATH
exec /usr/sbin/chroot /home/jail /bin/bash $*

./chroot.sh
/bin/bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: Error 40

~# ldd /usr/sbin/chroot
linux-gate.so.1 => (0xffffe000)
libc.so.6 => /home/jail/lib/tls/i686/cmov/libc.so.6 (0xb7eb2000)
/lib/ld-linux.so.2 (0xb7fe6000)

Last edited by bambeklis; 06-14-2008 at 05:51 AM.
 
Old 06-16-2008, 03:10 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Could you please post the steps you actually performed to set up your chroot?
 
Old 06-16-2008, 07:02 AM   #9
bambeklis
Member
 
Registered: Aug 2005
Posts: 58

Original Poster
Rep: Reputation: 15
I can't remember how I fixed that, but now I need a good howto put some users into the chroot env and they only could execute those cmds which I enabled for them.
 
Old 06-17-2008, 04:08 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Check out the LQ FAQ: Security references. Post #4 has some docs about chrooting. Not that you couldn't find those on the 'net yourself with even a cursory search...
 
Old 08-25-2008, 01:42 PM   #11
Nytridr
LQ Newbie
 
Registered: Jun 2008
Posts: 1

Rep: Reputation: 0
Red face

Quote:
Originally Posted by bambeklis View Post
I can't remember how I fixed that, but now I need a good howto put some users into the chroot env and they only could execute those cmds which I enabled for them.

well he can not remember but this is the exact problem I am having. I have a feeling it has to do with user permissions since as su root I can chroot myself with no errors. What I am trying to do is..

Someone ssh's into my server and I would like to have them chrooted to there home directory. I need to have it where I can setup different types of users with slightly different commands. in .bash_profile I tried to add sudo chroot /home/jail/home/testuser and I get get the following.

Code:
testuser@bots's password:
Last login: Mon Aug 25 03:39:15 2008 from laptop.local
/usr/sbin/chroot: cannot change root directory to /home/jail/home/testuser: Operation not permitted
testuser@bots:~$
heres the .bash_profile
Code:
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/login.defs
#umask 022

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
    PATH=~/bin:"${PATH}"
fi

/usr/sbin/chroot /home/jail/home/testuser
I have tried this


http://www.linuxquestions.org/questi...t-user-646112/

and it does not seem to affect it at all. I still get the same messages.

with
Code:
sudo /usr/sbin/chroot /home/jail/home/testuser
in the mix I get the following

Code:
testuser@bots's password:
Last login: Mon Aug 25 13:27:19 2008 from laptop.local
/bin/bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
testuser@bots:~$
I know how "well" documented this problem is, and figured since this is the only post anywhere I have found related to this exact problem it would be good to get a working solution for others to see.

I appreciate any help
Nyt

PS. Links I have used
Nice Jail Script http://www.fuschlberger.net/programs...p-chroot-jail/
Guide
http://www.troubleshooters.com/linux/prepostpath.htm
initial Guide - (have to find it again)

Last edited by Nytridr; 08-25-2008 at 02:06 PM. Reason: adding more context for you can better help me
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 05:47 AM
error while loading shared libraries: libgvc.so.3: cannot open shared object file coolrock Slackware 6 01-17-2007 05:10 PM
libgconf-2.so.4: - cannot open shared object tramni1980 Slackware 3 10-10-2006 04:35 PM
cannot open shared object file barells Linux - Software 2 07-16-2005 07:53 AM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration