Date: Wed, 22 Dec 2004 11:42:46 -0800 From: Kris Kennaway <kris@obsecurity.org> To: Jilles Tjoelker <jilles@stack.nl> Cc: Kris Kennaway <kris@obsecurity.org> Subject: Re: Forcefully unmounting devfs... Message-ID: <20041222194246.GC49344@xor.obsecurity.org> In-Reply-To: <20041222135734.GA57242@stack.nl> References: <84301.1103663813@critter.freebsd.dk> <41C89672.3000808@freebsd.org> <20041221232354.GA28374@xor.obsecurity.org> <20041222135734.GA57242@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Wed, Dec 22, 2004 at 02:57:34PM +0100, Jilles Tjoelker wrote:
> On Tue, Dec 21, 2004 at 03:23:54PM -0800, Kris Kennaway wrote:
> > Unfortunately that's going to cause me a fair amount of pain, unless
> > there's a simple way to kill all processes running in a given chroot
>
> Not that hard, although it is a bit tricky because command names may
> contain spaces, so something obvious like this does not work in the
> general case:
>
> fstat /chroot |awk '$4 == "root" { print $3 }'
>
> But the following seems more reliable, assuming the mount points do not
> contain spaces:
>
> #!/bin/sh
>
> # USER CMD PID FD MOUNT INUM MODE SZ|DV R/W NAME
> # jilles zsh 57711 root / 2 drwxr-xr-x 1024 r /
>
> D="$1"
> fstat "$D" | sed -Ene 's#^.* +([[:digit:]]+) +root +/[^ ]* +[[:digit:]]+ +.......... +[[:digit:]]+ +(r|rw|w) +'"$D"'$#\1#p'
>
> This would need some |xargs kill or similar.
Thanks, I hadn't thought of using fstat. I'll give this a try!
Kris
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)
iD8DBQFByc41Wry0BWjoQKURAlPRAKDB6aIu/OeB5oOamwOzEkrfH3PCNQCg1zNu
MqNbhiwJ6AJw9phmxTMOz3k=
=kc2j
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041222194246.GC49344>
