LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 04-03-2019, 09:20 PM   #1
Craftman
LQ Newbie
 
Registered: Apr 2019
Posts: 9

Rep: Reputation: Disabled
Unable to su to user after chroot


Hi guys,

I've encounter a issue when trying to su to another user after I chroot.

My jail directory = /home/jail
/bin and /lib64 are copied into my jail directory
Passwd and group are also copied into my jail directory.
I've also created a new user called Alex and password= Alex

I login using: Ssh root@localhost (success)
But when key in: su - Alex
Msg return : su:incorrect password

I tried this command too:
Chroot /home/jail /bin/su - Alex
Msg return : bin/su:incorrect password

Any expert can guide me as I'm relative new to Linux.
I'm using Oraclelinux 6.8 OS
 
Old 04-03-2019, 09:36 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Passwords are kept in /etc/shadow. Did you create user Alex inside the jail or on the host? Do /home/jail/etc/shadow and /home/jail/etc/passwd contain Alex?
 
Old 04-03-2019, 09:51 PM   #3
Craftman
LQ Newbie
 
Registered: Apr 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi berndbausch

Forgot to mention that I also did copy over the shadow file into my jail directory.

Both shadow and passwd file in my jail directory contain Alex and other user accounts.
 
Old 04-04-2019, 01:01 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by Craftman View Post
My jail directory = /home/jail
/bin and /lib64 are copied into my jail directory
Passwd and group are also copied into my jail directory.
I've also created a new user called Alex and password= Alex
You probably followed instructions at https://docs.oracle.com/cd/E37670_01...l/ch24s05.html, but to use su, you need more than that.
For example, su uses PAM for authentication, which requires /etc/pam.d and of course also all PAM binaries (which might be under /lib64). Try again after copying /etc/pam.d to the jail.

Apart from /bin, you may also want to have binaries under /usr/bin, /sbin and /usr/sbin in your jail. This depends on what exactly you want to achieve.

By the way, since the various bin and lib directories are essentially read-only, you are better off just bind-mounting them similarly to this:
Code:
# mkdir /home/oracle/jail/bin
# mount -o bind /bin /home/oracle/jail/bin
However, /etc should be copied rather than bind-mounted, since it contains files that will be written from within the jail.

Last edited by berndbausch; 04-04-2019 at 01:04 AM.
 
Old 04-04-2019, 03:14 AM   #5
Craftman
LQ Newbie
 
Registered: Apr 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi,

After copying pam.d over to my /home/jail/etc/

I tried just "su" and "su - Alex" command
Msg return : could not open session
 
Old 04-04-2019, 03:27 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I am not smarter than Google, I am afraid. An internet search for "could not open session" pam comes up with several results, including the rather promising https://access.redhat.com/solutions/303373.
 
  


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
[SOLVED] in chroot compiled programs do not work in chroot graphit Linux From Scratch 2 04-11-2010 03:04 AM
chroot to run hd-installed distro's programs from chroot in live distro? silencestone Linux - Software 0 10-12-2007 06:29 AM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
mount command not working in chroot. and now chroot not working mohit.jain Linux From Scratch 5 07-14-2006 03:57 AM
to chroot or not to chroot complus Linux - Security 4 02-29-2004 04:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

All times are GMT -5. The time now is 07:39 PM.

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