LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-13-2020, 11:11 AM   #1
terence
LQ Newbie
 
Registered: Feb 2004
Location: Edinburgh UK
Distribution: CentOS
Posts: 19

Rep: Reputation: 0
chroot file permissions


I have some old legacy programs compiled under Centos 6.5 which are no longer supported by the current Centos distros. I therefore made a copy of my old Centos 6 installation under a new directory (say, centos6.5) and copied all the libraries, system binaries and /etc to that directory. By doing

sudo chroot centos6.5 bash

I can run all the old programs without problem. Also, when I do chroot, I am automatically logged in as root. Since I've copied over the passwd* files in /etc, I can su to myself - again, no problem. However, when I create a home directory in centos6.5/home with the same username, the ownership and file permissions of the home directory are different once I log in using chroot. To have a home directory with the same ownership and permissions I have to create it after I log in with chroot. But this means any other personal files I then copy to centos6.5/home/<my username> have the same problems with ownership.

I don't understand why, if all the /etc/passwd* files are the same under my real system and my "chroot" system, this problem occurs. For example I have two different machines with the same passwd files and I can transfer files between the two and preserve all the ownership and permissions.

Any help would be much appreciated.

Terence
 
Old 11-13-2020, 04:04 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
Can you show us the commands and their output? Also check the uid and gid of centos6.5/home/myusername using the stat or ls -ln commands. Also try adding a user with useradd -u UID -g GID once you are chrooted.

I wonder if your kernel is compatible with Centos 6.5.
 
Old 11-16-2020, 09:00 AM   #3
terence
LQ Newbie
 
Registered: Feb 2004
Location: Edinburgh UK
Distribution: CentOS
Posts: 19

Original Poster
Rep: Reputation: 0
chroot file permissions

Quote:
Originally Posted by berndbausch View Post
Can you show us the commands and their output? Also check the uid and gid of centos6.5/home/myusername using the stat or ls -ln commands. Also try adding a user with useradd -u UID -g GID once you are chrooted.

I wonder if your kernel is compatible with Centos 6.5.
Thanks you to berndbausch - that is exactly what the problem is. It turns out I was transferring files from two different machines and my UID was different on each machine. I have now changed my UID to be the same everywhere and I can now transfer files to my chrooted account with the same ownership and permissions.

Marking this as SOLVED.

Thanks again for your prompt and helpful response,
Terence
 
  


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 - Software

All times are GMT -5. The time now is 09:26 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