A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally not access) files outside the designated directory tree.
Questions tagged [chroot]
583 questions
153
votes
5 answers
chroot "jail" - what is it and how do I use it?
I have heard/read a lot about the chroot jail under linux but have never yet used it (I use Fedora day-to-day), so what is a chroot "jail"? When and why might I use it/not use it and is there anything else I should know? How would I go about…
user119
93
votes
14 answers
chroot: failed to run command ‘/bin/bash’: No such file or directory
When I run the chroot command an error is given:
failed to run command ‘/bin/bash’: No such file or directory
USER3254789
- 1,061
- 1
- 7
- 3
61
votes
5 answers
How do I tell I'm running in a chroot?
I have a unix installation that's supposed to be usable both as a chroot and as a standalone system. If it's running as a chroot, I don't want to run any service (cron, inetd, and so on), because they would conflict with the host system or be…
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
56
votes
9 answers
How can I chroot into a filesystem with a different architechture?
I'm trying to chroot into a Arch Linux ARM filesystem from x86_64.
I've seen that it's possible to do using static qemu by copying the binary into the chroot system:
$ cp /usr/bin/qemu-arm archarm-chroot/usr/bin
But despite this I always get…
Jivings
- 935
- 1
- 7
- 11
53
votes
5 answers
How to create a FTP user with specific /dir/ access only on a Centos / linux installation
So I'm on a VPS - CentOS Linux installation. I have vsFTPd on the server.
I currently have SFTP access to the server via my root user, but am now trying to create a new user with FTP access to a specific directory only on the server, I've done the…
user1231561
- 633
- 1
- 6
- 4
47
votes
4 answers
Limit FTP access only to the /var/www with vsftpd
I am running vsftpd as ftp server on my linux (rasbian), I log in to the machine as a root user.
I would like to be still locked to using only /var/www, how can I configure vsftpd conf to accomplish it?
Badr Hari
- 585
- 1
- 6
- 8
41
votes
3 answers
Restricting an SSH/SCP/SFTP user to a directory
Is there a simple way to restrict an SCP/SFTP user to a directory? All methods that I've come across require me to set a chroot jail up by copying binaries, but I don't think that should be necessary.
user4518
38
votes
1 answer
How can I access a directory outside a chroot from within it?
I have a user which is chrooted to her home directory, but I want her to also be able to manage files within /var/www. As such, I did the following:
root@server:/home/username# ln -s /var/www www
root@server:/home/username# cd…
Doc
- 503
- 1
- 6
- 10
26
votes
5 answers
How to unmount a formerly chroot'd filesystem?
I'm using a rescue-live-system (similar to a live-cd) to fix some issues with my Debian server, like that:
# mkdir -p /mnt/rescue
# mount /dev/md2 /mnt/rescue
# mount --bind /dev /mnt/rescue/dev/
# mount --bind /proc /mnt/rescue/proc/
# mount --bind…
q9f
- 2,308
- 8
- 29
- 39
21
votes
1 answer
How to perform chroot with Linux namespaces?
After reading about Linux namespaces I was under the impression that they are, amongst a lot of other features, an alternative to chroot. For example, in this article:
Other uses [of namespaces] include [...] chroot()-style isolation of a process…
koalo
- 315
- 2
- 15
20
votes
2 answers
What to use to harden Linux box? Apparmor, SELinux, grsecurity, SMACK, chroot?
I am planning to go back to Linux as a Desktop machine.
I would like to make it more secure. And try a few hardening techniques, especially since I plan to get my own server.
What would be a good, sane hardening strategy? Which tools should I use -…
jottr
- 1,286
- 3
- 14
- 19
17
votes
4 answers
Lightweight isolated linux environment
I want an isolated (guest) Linux environment on my computer that I can mess up without worrying about the host. E.g. install a lot of stuff from source without package management, pollute environment environment variables etc., then spawn another…
math4tots
- 2,665
- 8
- 32
- 42
16
votes
3 answers
Boot into a chroot?
I have Linux (Debian Jessie) installed on a hard drive. Drive - sda1, ext4fs, and sda2 - swap
I have a /chroot folder. There is installed another system, in /chroot folder.
Question:
How to tell the bootmanager, to boot not the primary system (main,…
skrepki
- 161
- 1
- 3
16
votes
3 answers
Simulate chroot with unshare
I am trying to write a bootstrapper for a minimal, from-source linux distribution.
I would like to build in a chroot-like environment. This should simplify packaging. I do not care about security at this point. The bootstrapper should not require…
Rooties
- 161
- 1
- 4
16
votes
3 answers
How to use/test pivot_root?
I want to test the pivot_root command which moves the root file system of the current process to the directory put_old and makes new_root the new root file system.
But I always get the following error:
pivot_root: failed to change root from .'…
vvilp
- 371
- 2
- 4
- 9