N
N
nepster-web2014-02-06 18:55:16
Network administration
nepster-web, 2014-02-06 18:55:16

How to add commands to a user, jailkit?

Installed jailkit, please tell me how to add commands such as
node, npm, yum to the user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Zhivotnev, 2014-02-06
@inkvizitor68sl

> yum
What's the point? He can only use it from root, and becoming a root inside the jail, he will become a root in the entire system if he wants (through loading a kernel module, for example). If you issue sudo on yum, you can still slip a package that will load the kernel module.
For other packages:
yum install --installroot=/path/to/jail package
As root on the host system. True, it will drag along a bunch of dependencies.
If the packages do not help, then try this first:
jk_cp -v -f /path/to/jail /usr/bin/node
If it doesn’t help (and you assembled the node by hand), you will have to decompose all the files manually inside the jail. Just do not forget that from the jail the node will also run inside the jail. Therefore, it will not be able to interact with anything else through the unix sockets of the main system (for example, through /var/run/mysql.sock , if the node already knows it). Yes, and she probably needs / dev (I'm talking about the node in daemon mode).
In general, you will need to febootstrap centos somehow (but centos is shit as usual, and you will have to manually find the archive you need or use debian as a jail) and use it as a jail.
Well, mount service file systems inside jail. At least /proc, /dev/, /sys, /dev/pts
Then it will be possible to talk about running daemons inside the jail. But it will greatly reduce security.
Jail is still designed to allow the user to work with files via ssh with a hard limit within a certain system directory, which contains all the binaries and libraries that the user can run.
In general, if you really need it, then you need to do this first:
https://debian.pro/440 (replace debootstrap with unpacking the archive with a minimum centos)
Then from here https://debian.pro/1237
useradd - d /home/jailuser1 -m jailuser1 -s /bin/bash
jk_jailuser -m -j /jails/jailuser1/ jailuser1
Instead of jk_init/jk_cp, you will already use yum inside the jail from root (you can use the command cd /path/to/jail ; chroot . from root to log in as root to jail)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question