I currently need to do the following
sudo chroot /chroot/mint32
but then I end up as root in the chroot and need to do su ryan
I want to just do chroot /chroot/mint32 but I get chroot: cannot change root directory to /chroot/mint32: Operation not permitted
How can I grant a user permissions to chroot? SOLVED
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
How can I grant a user permissions to chroot? SOLVED
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How can I grant a user permissions to chroot?
From http://en.wikipedia.org/wiki/Chroot:
I don't know if it's possible to grant a non-root user the privileges to chroot, and I wouldn't recommend it either.Only the root user can perform a chroot. This is intended to prevent users from putting a setuid program inside a specially-crafted chroot jail (for example, with a fake /etc/passwd and /etc/shadow file) that would fool it into a privilege escalation. It also prevents chroot from being used as an unprivileged sandboxing mechanism (for example, for users to run and test untrusted applications downloaded from the Internet).
Re: How can I grant a user permissions to chroot?
I see, I was hoping to make a makefile that would do the followingvincent wrote:From http://en.wikipedia.org/wiki/Chroot:I don't know if it's possible to grant a non-root user the privileges to chroot, and I wouldn't recommend it either.Only the root user can perform a chroot. This is intended to prevent users from putting a setuid program inside a specially-crafted chroot jail (for example, with a fake /etc/passwd and /etc/shadow file) that would fool it into a privilege escalation. It also prevents chroot from being used as an unprivileged sandboxing mechanism (for example, for users to run and test untrusted applications downloaded from the Internet).
make all
make
./script
where script has
chroot /chroot/mint32
cd <the directory>
make
(somehow changing the .o file location and the executable location)
That way I can compile for x86 and 64 at the same time.
If I need to be root I guess that I need to do sudo make all to have it work?
Re: How can I grant a user permissions to chroot?
"make" shouldn't need to be run as root or with sudo. "chroot" will, however.
Re: How can I grant a user permissions to chroot?
Yeah well I can do the chroot as root then su to my account, but I still need a way to do this with a makefile. Any ideas? My main post about that is http://forums.linuxmint.com/viewtopic.php?f=47&t=52105vincent wrote:"make" shouldn't need to be run as root or with sudo. "chroot" will, however.
Re: How can I grant a user permissions to chroot?
Nope, I'm no good with makefiles and the like, sorry.
Re: How can I grant a user permissions to chroot?
Maybe something like
Assuming the Makefiles support DESTDIR
Code: Select all
#!/bin/bash
# Build 32-Bit version in background
sudo chroot /chroot/mint32 \
su ryan -c /bin/bash -c "cd <32-Bit build folder> ; make" &
# build 64-Bit version
( cd <64-Bit build folder>
make
)
# wait for 32-Bit version to finish
wait $!
# install 64-bit version to ~/Desktop/project/bin64
( cd <64-Bit build folder>
make install DESTDIR="~/Desktop/project/bin64"
)
# install 32-Bit version to ~/Desktop/project/bin32
( cd /chroot/mint32/<32-Bit build folder>
make install DESTDIR="~/Desktop/project/bin32"
)
Re: How can I grant a user permissions to chroot?
Thanks for the reply, I found my own way to do it, but I will try to add your background thing so they can do it at once,
mv linux64/*.o linux64/*.d linux64/euchre .
make
mv *.o *.d euchre linux64
sudo mount /chroot/mint32/proc
sudo mount /chroot/mint32/home
sudo mount /chroot/mint32/tmp
sudo chroot /chroot/mint32 su ryan -c /bin/bash -c "cd ~/Desktop/CS246/game; make"
mv linux32/*.o linux32/*.d linux32/euchre .
mv *.o *.d euchre linux32
Thanks a million .
mv linux64/*.o linux64/*.d linux64/euchre .
make
mv *.o *.d euchre linux64
sudo mount /chroot/mint32/proc
sudo mount /chroot/mint32/home
sudo mount /chroot/mint32/tmp
sudo chroot /chroot/mint32 su ryan -c /bin/bash -c "cd ~/Desktop/CS246/game; make"
mv linux32/*.o linux32/*.d linux32/euchre .
mv *.o *.d euchre linux32
Thanks a million .