Slashdot Log In
Chroot in OpenSSH
Posted by
ScuttleMonkey
on Wednesday February 20, @01:48PM
from the making-life-easier-always-my-goal dept.
from the making-life-easier-always-my-goal dept.
bsdphx writes "OpenSSH developers Damien Miller and Markus Friedl have recently added a nifty feature to make life easier for admins. Now you can easily lock an SSH session into a chroot directory, restrict them to a built-in sftp server and apply these settings per user. And it's dead simple to do. If you need to allow semi-trusted people on your computers, then you want this bad!"
Related Stories
[+]
When Not to Use chroot 407 comments
Hyena writes "Linux guru Alan Cox is quoted as saying 'chroot is not and never has been a security tool' in a KernelTrap article summarizing a lengthy thread on the Linux Kernel mailing list. The discussion began with a patch attempting to 'fix a security hole' in the Unix chroot command, trying to improve the ability of chroot to contain a process. When it was pointed out that people have been using chroot as a security tool for years, another kernel hacker retorted, 'incompetent people implementing security solutions are a real problem.' A quick search on the terms 'chroot+security' quickly reveals that many people have long thought (wrongly) that chroot's purpose was for improving security."
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading ... Please wait.

Why bother? (Score:3, Insightful)
Re:Why bother? (Score:4, Interesting)
Re: (Score:2)
Re:Why bother? (Score:5, Informative)
Giving someone an SFTP session and chrooting them into a subdirectory is another thing.
The feature added in this commit was arguably intended for the latter purpose given the additional changes to the SFTP subsystem that were included. There are countless tutorials and patches and scripts that are available to achieve chrooted SFTP-only access, but now it's been implemented in the core of OpenSSH. In my eyes, this solution is not only a "cleaner" solution to the problem, but it's probably more secure too.
Re:Why bother? (Score:5, Informative)
Basically, to break out of a chroot you need to be root. If you're root, then you've already defeated the security on the box anyway. Don't let untrusted users become root.
Tell us more. (Score:2)
Re: (Score:3, Informative)
Step 1: Become root
Once you are root, there are dozens of ways to break out of a jail (all the way from modifying kernel memory structures directly to rewriting inodes to installing a kernel module that grants
Re:Tell us more. (Score:5, Informative)
In the right circumstances, 2 non-root users can conspire to break out of jail if one is chrooted below the other.
Let's say A is chrooted to /home/sorta-trusted and B to /home/sorta-trusted/not-so-much.
A diropens his / and creates a unix socket in /not-so-much. B opens the socket in his /. Now, A passes his fd to his / to B. B then does fdchdir on the fd and he's out of jail. Now B can break A out.
The moral is, never use nested chroot jails!
Re: (Score:3, Informative)
It's far worse, at least in the Linux kernel (and quite probably other Unix as well but I haven't studied them). The linux kernel assumes that the PWD is at or below the chroot. When a system call parses a pathname, it substitutes the chroot for a leading
Re:Why bother? (Score:5, Informative)
I imagine something similar would be forthcoming regarding OpenSSH specifically.
Re:Why bother? (Score:4, Informative)
For regular user accounts, a properly configured chroot jail is still a very useful security tool.
Re: (Score:2)
Only when you have full shell access. This patch is just about confining sftp file transfers via chroot(2) for some users without the burden of setting up a full chrooted environment. Sounds really s
FTP servers have been doing this for years (Score:4, Informative)
It's only natural that this same chroot feature would be added to sftp.
Re:Why bother? (Score:5, Insightful)
Oh thank god (Score:3, Interesting)
Now I can finally switch some customers from FTP to SFTP. Thanks for making this hugely useful change!
Anyone know if SFTP logging will be added any time soon? That's the last missing feature i always have to manually patch in.
Re: (Score:3, Insightful)
Re: (Score:2)
For real? My sarcasm meter is out of whack today so I can't tell.
Re: (Score:2)
I'm still hankering for tab completion in SFTP myself... maybe someday.
Re: (Score:3, Informative)
It will let you connect to sftp servers, and have a sane command line experience. It also has many nifty mirroring commands.
Nothing New (Score:2, Informative)
Does This Mean (Score:3, Interesting)
all that for sftp? (Score:4, Interesting)
Re:all that for sftp? (Score:4, Insightful)
Why? No privilege separation. A MUCH bigger code base.
Not to mention fewer standalone programs.
Why not? The user security model is reliable and time tested. It does not require reinventing the "user". It does not depend on one program handling it's own system of virtual permissions correctly. It does not depend on the security of a large program that users directly interact with.
I can see ample reasons sftp is safer.
Re: (Score:2)
Re: (Score:3, Informative)