Tag Info

Hot answers tagged

15

All this pain is thanks to several security issues as detailed here. Basically the chroot directory has to be owned by root and can't be any group-write access. Lovely. So you essentially need to turn your chroot into a holding cell and within that you can have your editable content. sudo chown root /home/bob sudo chmod go-w /home/bob sudo mkdir ...


13

chroot is a way of entering a folder and 'faking' that folder being / to anything executed inside. This lets you run executables on a non-booting Ubuntu installation by mounting it somewhere other than / and using /bin/bash(the one inside the installation) to get a terminal prompt. sudo - Lets certain accounts authenticate to run a program as root or ...


8

Verify that you are using the right Live CD. For example, verify you are not using a 32bit CD instead of a 64bit CD. You need a 64bit kernel to run 64bit code, so check your architecture. Assuming you mounted your system to be chrooted in /media/sda1, to determine the architecture you can: ls /media/sda1/* if you see lib64 in the output, it's probably a ...


5

Symlinks are locked into the jail the same way the user is; otherwise it would be possible for the user to break out of the jail with cd documents. (No, root-created symlinks can't be treated specially, for the same reason that cd -P symlink-to-dir; cd .. leaves you in the wrong place; the appearance of it working as you'd expect is an illusion created by ...


5

The persistant usb drive uses a compressed read-only filesystem (squashfs) and overlays a writable filesystem layer on top that stores changed files. The writable filesystem is stored in a single file (like a zip file, but without the compression - it is actually ext3, but that is unimportant) To put everything 'back together': Create the locations where ...


5

Create a user who has access to only this directory: useradd -d "`pwd`" -s /bin/bash -c "Temporary" temporary passwd temporary su temporary Do whatever you want with this user. The current directory is his home directory, he can't destroy anything outside of it. Once you're done, exit the su with Ctrl-D, then do: userdel temporary You could make ...


4

In order to chroot to do things like.. configure/install grub, do the following- #first, mount new install to /mnt/oneiric mount -t proc proc /mnt/oneiric/proc mount -t sysfs sys /mnt/oneiric/sys mount -o bind /dev /mnt/oneiric/dev chroot /mnt/oneiric /bin/bash I wouldn't try to start full gnome this way. The only reason you should really be doing this ...


3

To chroot an SFTP directory, you must 1) create an user and force root to be owner of it cd /home mkdir john useradd -d /home/john -M -N -g users john sudo chown root:root /home/john sudo chmod 755 /home/john 2) Change the subsystem location on /etc/ssh/sshd_config: #Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp internal-sftp and create ...


3

I don't trust anything but the kernel to keep a sane state here, so I don't (ab)use init to get this job done, nor do I count on myself actually knowing what is or isn't mounted (some packages can mount extra filesystems, like binfmt_misc). So, for process slaughter, I use: PREFIX=/mnt/chroot-0 FOUND=0 for ROOT in /proc/*/root; do LINK=$(readlink ...


3

Many developers use pbuilder for this task. There is a very comprehensive guide to pbuilder on the Ubuntu wiki. You might also look into the pbuilder-dist script. It is a is a wrapper that makes it easy to use pbuilder with many different versions of Ubuntu and/or Debian. It is available in the ubuntu-dev-tools package.


3

It's pretty easy to add your own variant with additional custom packages to debootstrap. The debootstrap configuration/runtime scripts are located in /usr/share/debootstrap/scripts. Let's create an allmybase variant which includes everything in minbase along with the packages htop and traceroute. Open /usr/share/debootstrap/scripts/precise in your ...


2

There is a typo on your instructions, on /etc/schroot/chroot.d/hardy-i386 you are using /srv/chroot/hardy-i386 , while for the mkdir/debootstrap you are using hardy_i386 for the directory. That explains the error. I have just fixed the path at /etc/schroot/chroot.d/hardy-i386, tested, it worked as expected.


2

You can boot a sub directory by replacing your sbin init with a script which uses pivot_root, the process is sketchy and various people have reported failure as much as sucesses. So try it and see, but keep a live cd handy in case your system becomes unbootable. Details here: http://linux.die.net/man/8/pivot_root What we could do with, is an automatic ...


2

Well I finally found out that I copied the required libraries on wrong folder, because when I tested chroot for first time I was on a 32bit Ubuntu Machine, while my server is 64bit. So, I copied the required libraries and bin/sh at the proper folders at my directory that I would like to jail and it worked just fine. :D Thanks you all!


2

The package schroot supports LVM and Btrfs snapshots. From its man page: Source chroots Some chroot types, for example LVM snapshots and Btrfs snapshots, provide session-managed copy-on-write snapshots of the chroot. These also provide a source chroot to allow easy access to the filesystem used as a source for snapshotting. These are regular ...


2

When you start a chroot environment, you are generally already root, so you don't need to use sudo or su root. If you need to use a non-root user account, you need to create it first, and login as that user with (in the chroot) login myuser or su - myuser Next, if you want to let that user to use sudo, you need to add it to the admin group into the ...


2

If you're not short of a bit of space, you could use debootstrap to install a minimal complete OS in your chroot. This then makes apt available in your chroot. To start with: sudo apt-get install debootstrap To setup a new chroot: sudo debootstrap oneiric /path/to/chroot sudo chroot /path/to/chroot /bin/bash Voila, you're in a new minimal Ubuntu ...


2

The package pbuilder is exactly what you need. It will allow you to construct a chroot environment, build and install your package. Even a pbuilder-cross variety exists. It is a set of command line tools, so no virtual machine point and click required. After a steep but short learning curve, you can probably automate building different architectures and ...


2

You can't really run upstart itself in a chroot. For it to work, you'd need something like an LXC container. Unfortunately most Android kernels don't have the required options to allow LXC to work. Without LXC, the way of getting a chroot on your phone is to run: sudo debootstrap --foreign --arch=armhf precise precise then copy precise/ to your phone then ...


2

There are a couple of techniques, the simplest is to use a chrooted environment. In this environment you can then run sudo aptitude update and most other command line tools. Alternatively you could create a number of virtual box virtual machines that used the partitions as their hard drives - I have not tried this. For the chroot environment mount each ...


2

Let me try to explain chroot in terms of Windows. In windows the "root" of the boot partition is called "C:\" In Linux it is called "/". choort (temporarily) allows you to make some other folder/partition/device the root partition. If Windows had a choot command it might have worked as follows. Imagine you have a computer with two partitions or drives with ...


2

chrrot has nothing to do with dual booting. The idea behind chroot is an ability to switch one program, or one shell, etc., to a new root directory, allowing you to have multiple "systems" at the same time. "systems" is in quotes because there is still only one Linux kernel running. This other "system" is an additional set of the code tools, home ...


2

This will unfortunately not answer your question in any way, but it will hopefully increase your knowledge of how Ubuntu works a lot. No offence if you knew these things already. But if not, then I cannot let you not knowing those tips. The comments section is too small for this explanation. Installing a program I have the impression that you downloaded ...


1

For the most part, do-release-upgrade is a wrapper around dist-upgrade with some additional functionality. As noted, it is the recommended official way to upgrade Ubuntu minimal/server installations. Unofficially, dist-upgrade after changing your sources.list often works just as well. The difference is: using do-release-upgrade is recommended because it ...


1

I feel like nobody gave a full technical explanation, so here goes. To understand a chroot you first have to understand the split between kernel (The Linux in GNU/Linux) and userspace (the GNU in GNU/Linux, or possibly something else, like busybox.) The kernel controls all the hardware in your computer. It also provides the APIs for file access, ...


1

Not really, no. Booting an OS involves loading a kernel that controls the hardware and then runs a number of other programs. chroot runs a program ( typically a shell, from where you can run other programs ) under your current kernel, only the kernel lies to the program and pretends that the root directory is some other directory than the one it is really ...


1

you could run it in a chroot environment..but odds are chroot would 1 require a fair amount of work, and 2. more importantly would require root access. (in which case sudo ln -s /mnt/cdrom /home/me/stuff would be much easier. ). I would suggest just having a VM you can boot/play. VMware Player can play a VM you setup somewhere else...and you probably ...


1

There's more to it than you think to get a working chroot jail. In your example, it's because the sudo command is in /bin and not available in your new root. But just installing the base packages to the new root won't do the trick, you also need to mount a /proc, /sys and /dev for the jail, probably create a couple of symbolic nodes, definitely a tty and for ...


1

Try issuing the following commands outside of the chroot. I had to issue these before I could access anything being served from within the chroot, and still have to issue them every time. iptables -F iptables -P INPUT ACCEPT iptables -X ALLOWED_PACKETS iptables -X ICMPFLOOD iptables -X INVALID_PACKETS



Only top voted, non community-wiki answers of a minimum length are eligible