How to chroot(change root) for all user on linux?



Env :
SSH : 4.3p2
Linux : RHEL 5.5
Kernel : 2.6.18-194.32.1.el5
Arch : 64 bit


BE VERY CAREFUL BEFORE DOING THIS :
Here is what I did :

On SSH server :

1. Add the following in /etc/ssh/sshd_config

ChrootDirectory /test

2.

# mkdir /test
# cd /test; mkdir bin lib64 [ on 32 bit server create 'lib' instead of lib64 ]
# cp /bin/bash /test/bin

# ldd /bin/bash
libtermcap.so.2 => /lib64/libtermcap.so.2 (0x000000387f800000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000387fc00000)
libc.so.6 => /lib64/libc.so.6 (0x000000387f400000)
/lib64/ld-linux-x86-64.so.2 (0x000000387f000000)

Then copy all libraries under /lib64 to /test/lib64/ [ for example # cp /lib64/libtermcap.so.2 /test/lib64/ ]

3. If customer want to use 'ls' command in chrooted environment, repeat the same steps for ls too.

4. Restart sshd server like : /etc/init.d/sshd restart

By : cpanel.net



Related Posts:



Responses

0 Respones to "How to chroot(change root) for all user on linux?"

Post a Comment

»Thank you for reading this article
If you have questions or comments, please leave a comment
»You can click on the Subscribe by email to subscribe comments of this post
»You can register directly link pictures, mp3, video on the comment form.
»You may use some HTML tags such
»Please post comments polite and typing accented Vietnamese if possible
»Thank the good faith comment

 

Categories

Recent Comments

Error loading feed.

Total Pageviews

624913
Return to top of page ©Web Server Tips Tricks 2010 | Develop by Mr.PhanQuan .Powered by Blogger . All rights reserved.