1834528 Members
3275 Online
110068 Solutions
New Discussion

chroot environment

 
Pippo_9
Frequent Advisor

chroot environment

Hello again,

I had a problem to set a chroot environment.
I followed doc A4161307 but it is old and system asks other libraries. After copying those libraries all seem work but I obtain

# telnet pippo
login: bal
Password:
Subsystem root: /home/bal/
login: bal
Login incorrect
login: Connection closed by foreign host.
#

Can anybody help me to set a good chroot environment?

Thanks in advance!

Kind regards,
Pedro
4 REPLIES 4
Kent Ostby
Honored Contributor

Re: chroot environment

Not exactly what you're trying to accomplish, but in general, nowadays, you can simply type:

chroot newroot shell

Example:

If you wanted / to be what you is currently /newdir then you could type:

chroot /newdir /bin/sh

This will kick off the /bin/sh and refer to /newdir as /

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Sundar_7
Honored Contributor

Re: chroot environment

Hi Pedro,

Are you to trying to setup a chroot login for ur user ?

It only provides the system prompt; you'll need to move over any
files/commands/libraries that you want in a manner similar to that
outlined in the following steps:

1. mkdir the following:

/home/bal/dev
/home/bal/usr
/home/bal/sbin
/home/bal/usr/bin
/home/bal/etc
/home/bal/usr/lib

2. cp the following:

/usr/lib/dld.sl /home/bal/usr/lib
/usr/lib/libc.1 /home/bal/usr/lib
/usr/lib/libdld.1 /home/bal/usr/lib
/usr/lib/libsec.1 /home/bal/usr/lib

3. vi /etc/passwd and make this change:

bal::107:20::/home/bal:/sbin/sh

to

bal::107:20::/home/bal:*

4. cp /etc/passwd /home/bal/etc/passwd

5. vi /home/bal/etc/passwd and make this change:

bal::107:20::/home/bal:*

to

bal::107:20::/:/sbin/sh

6. cp the following:

/etc/group /home/bal/etc/group
/usr/bin/login /home/bal/usr/bin/login
/sbin/sh /home/bal/sbin/sh

7. cd /dev

8. find config | cpio -pdumvx /home/bal/dev

9. find tty | cpio -pdumvx /home/bal/dev

10. Try logging in as the user.
Learn What to do ,How to do and more importantly When to do ?
Pippo_9
Frequent Advisor

Re: chroot environment

Hi Sundar,

thanks for your response but those steps exactly are into doc A4161307. I know that other dev/files/libraries are needed and even other libraries than doc A4161307.
I already tried it and I obtain

# telnet pippo
login: bal
Password:
Subsystem root: /home/bal/
login: bal
Login incorrect
login: Connection closed by foreign host.
#

I hope to receive other hints!

Kind regards,
Pedro
Pippo_9
Frequent Advisor

Re: chroot environment

Hello everybody again,

I found S1100003443 - Sys Adm: Using sub-login feature of login(1) on HPUX 11.00

and it helped me to solve the problem.

However thanks for your hints!

Pedro