0

What is the reason that copying .bash_profile from the host system into the /root directory of an iocage thin jail does not create a file that is visible to the root user when logged on to that jail?

In other words, if I do this from the host system:

cp -p .bash_profile /zroot/iocage/jails/testjail/root/

Then ls -al /zroot/iocage/jails/testjail/root/.bash_profile shows that the file exists.

ls -al /zroot/iocage/jails/testjail/root/.bash_profile
-rwxr-xr-x  1 root  wheel  3274 Dec 12 15:42 /zroot/iocage/jails/testjail/root/.bash_profile

However, when I log on to testjail the file is not visible to the root user:

iocage console testjail
ls -a .bash_profile
ls: .bash_profile: No such file or directory

If I check the mounts on the host system then amoung other things I see this:

zroot/iocage/jails/testjail/root on /zroot/iocage/jails/testjail/root (zfs, local, noatime, nfsv4acls)

Which I believe is the source of my difficulty. How do I put a file into the /root directory of an iocage jail so that it is usable by the root user inside the jail?

0
zroot/iocage/jails/testjail/root on /zroot/iocage/jails/testjail/root (zfs, local, noatime, nfsv4acls)

Q: "... mounts on the host system ... is the source of my difficulty. How do I put a file into the /root directory of an iocage jail so that it is usable by the root user inside the jail?"

A: FWIW. A test file created in a similar mount-point

zroot/jails/test_01 on /local/jails/test_01 (zfs, local, nfsv4acls)
$ touch /local/jails/test_01/root/TEST-FILE
$ ll /local/jails/test_01/root/TEST-FILE 
-rw-r--r--  1 root  wheel  0 Dec 13 12:56 /local/jails/test_01/root/TEST-FILE

is available to root

$ ssh admin@test_01
$ sudo su
root@test_01:/home/admin # bash
root@test_01:/home/admin # cd /root
root@test_01:~ # ll /root/TEST-FILE
-rw-r--r--  1 root  wheel  0 Dec 13 11:56 /root/TEST-FILE

Notes:

  • FreeBSD jails.example.com 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC i386
  • Jails created with the Ansible role.
  • Well, I discovered the answer. /zroot/iocage/jails/testjail/root is not the home directory of the root user. /zroot/iocage/jails/testjail/root/root is. Apparently the iocage design team did not consider the confusion that might result by naming the 'root' of a jail's file system the same as the home directory of the root user. In any case the mystery is solved. – James B. Byrne Dec 13 '19 at 14:44
0

The directory /zroot/iocage/jails/testjail/root/ is not the home directory of the root user; /zroot/iocage/jails/testjail/root/root/ is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.