jk_cp(8)
π¦ NAME π¦
jk_cp β a little utility that copies files into a jail, and it brings the permissions and the libraries along too, bestie π
β¨ SYNOPSIS β¨
jk_cp -j jail source
jk_cp -v -k -f -j jail source
πΈ DESCRIPTION πΈ
okay so here's the whole vibe: jk_cp will copy any file into a jail, and it puts it at the identical location it came from, with identical permissions, and β if it needs to β it drags along any required libraries too. like, it's not gonna let your binary show up in the jail all alone and helpless π it brings the whole friend group.
and then, the part you need to know: it will remove any set user id (setuid) or set group id (setgid) permissions from all files and directories it copies. every single one. no exceptions, no leftovers, periodt π that's a security thing and it is not negotiable, so don't come crying when your setuid bit is gone, it was literally never making it in.
π EXAMPLE π
jk_cp -j /home/testchroot /usr/bin/cvs
this one copies /usr/bin/cvs over to /home/testchroot/usr/bin/cvs, and it also copies the libraries that cvs uses into the jail, so the whole thing actually works when it gets there π«Ά
jk_cp -k -j /svr/testjail /usr/bin/firefox /usr/share/firefox
and this one hardlinks /usr/bin/firefox plus all files in /usr/share/firefox into the jail /svr/testjail. slay, no copying, just linking π₯
π OPTIONS π
-j,--jailβ the destination jail. and lowkey important: if you don't specify a jail, then the first argument gets used as the jail instead, for backwards compatibility. iykyk π-f,--forceβ force overwriting of existing files. it's giving "i said what i said" π-k,--hardlinkβ try to create hardlinks instead of copying the files. and if the linking fails? it falls back to copying, no drama, we adapt π-o,--ownerβ retains the file ownership and group when copying files and directories. so they keep their whole identity π-v,--verboseβ will give verbose output. it will literally tell you everything, it's a yapper and we love that for it π-h,--helpβ the help screen β¨
π SEE ALSO π
jailkit(8) jk_check(8) jk_chrootlaunch(8) jk_chrootsh(8) jk_init(8) jk_jailuser(8) jk_list(8) jk_lsh(8) jk_procmailwrapper(8) jk_socketd(8) jk_uchroot(8) jk_update(8) chroot(2)
(yes jk_socketd(8) really does show up twice, that's the original's energy, not mine, don't @ me π)
π COPYRIGHT π
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Olivier Sessink
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
and that's the whole page, bestie π this one's from the JAILKIT manual, it's jk_cp(8), and it's dated 07-02-2010. iconic. obsessed. go copy some files into a jail responsibly πβ¨
π¦ where this page comes from
- debian bookworm: jailkit 2.23-2 Β· BSD-3-Clause
- debian trixie: jailkit 2.23-2+b1 Β· BSD-3-Clause
- ubuntu jammy: jailkit 2.23-1 Β· BSD-3-Clause
- ubuntu noble: jailkit 2.23-2 Β· BSD-3-Clause
- ubuntu questing: jailkit 2.23-2
- ubuntu resolute: jailkit 2.23-3 Β· BSD-3-Clause
- ubuntu stonking: jailkit 2.23-3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms