Change user in Linux Jail reddit / freebsd ---------------------------------------------------------------------- Puzzleheaded_Bass_59 · 2022-08-25 04:49 Hi All, I have installed LinuxJail using Ubuntu in FreeBSD using this [tutorial](https://wiki.freebsd.org/LinuxJails). This is because I wanted to development work on FreeBSD using Linux packages. I managed to install all I want using \`apt\` package manager. However, I do not want do any work in \`root\` user mode. \`Ctrl+D\` switches to FreeBSD terminal. Please have a look at below image. \`schroter\` is a user in FreeBSD however it is present in Linux home directory as well so I would like to switch to it. Would anyone be able to help me in this matter please? Thanks & Best Regards Schroter Michael ​ https://preview.redd.it/ycib9wjcisj91.png?width=828&format=png&auto=we bp&s=1be425e4342dfba230d44a145fe18e7f1f8c0005 ---------------------------------------------------------------------- da_peda · 2022-08-25 07:39 2 things: 1. if you set it up exactly according to that Wiki page you created a [`chroot (8)`](https://www.freebsd.org/cgi/man.cgi?chroot(8)) environment, not a full Jail 2. it states > To get your environment variables set up in the typical Ubuntu way you might want to start sshd(8) (service ssh start) and log in this way; you can add chroot /compat/ubuntu /usr/sbin/service ssh start to /etc/rc.local to make it run at boot. so this is something you might have to do too. If I remember I'll look into setting up a correct jail with this after my vacation. ---------------------------------------------------------------------- Puzzleheaded_Bass_59 · 2022-08-25 08:18 Hi, thanks for the reply. I only wanted to install some python modules (Jupyter, selenium, sklearn) which could not be done under FreeBSD directly with minimal overhead. Just wanted to know how to get out of root. Since, it makes me edgy. Thanks & Best Regards Schroter Michael ---------------------------------------------------------------------- da_peda · 2022-08-25 08:27 You can't easily. Entering a `chroot` requires root permissions and you'd have to explicitly drop them after. What you could do: 1. Enter the chroot (as you are at the end of your screenshot) 2. Create a new user using `adduser` in the subsystem 3. Connect either via `ssh` using the instructions from the Wiki page, or by running `su - $NEWUSER` Regarding the Python modules, if the versions available via `pkg` aren't recent enough, maybe install the ports instead? I see * `py39-jupyter-client-6.1.12_1` * `py39-jupyter-server-1.18.1` * `py39-selenium-3.141.0_1` * `py39-sklearn-pandas-2.2.0` available via the `latest` repo. ---------------------------------------------------------------------- Puzzleheaded_Bass_59 · 2022-08-25 11:12 I was not comfortable installing python and modules system wide. Tried installing in a virtual environment it did not work. Not sure whether it would have worked if I had new led Linux binary compatibility. ---------------------------------------------------------------------- pstef · 2022-08-25 13:48 If it's really a jail, create your new user and then invoke `su root -c 'jexec -l linux login -f user'`. As for python, I don't know the details, but wouldn't something like `pip install --user ...` suffice in your case? ---------------------------------------------------------------------- himay81 · 2022-08-25 16:07 Did you try to install the ports into a venv, or did you try to pull them in via pip? pip-installed modules should work fine in a venv. ---------------------------------------------------------------------- Puzzleheaded_Bass_59 · 2022-08-26 04:44 Hi, Thanks. It worked was able to change to user after creating one on the subsystem. But I am unable to run firefox within the subsystem. I get: (newEnv) schroter1@SCHROTER:~$ jupyter lab[I 2022-08-26 04:39:16.136 ServerApp] jupyterlab | extension was successfully linked.[I 2022-08-26 04:39:16.174 ServerApp] nbclassic | extension was successfully linked.[I 2022-08-26 04:39:16.845 ServerApp] notebook_shim | extension was successfully linked.[I 2022-08-26 04:39:16.985 ServerApp] notebook_shim | extension was successfully loaded.[I 2022-08-26 04:39:16.989 LabApp] JupyterLab extension loaded from /home/schroter/newEnv/lib/python3.10/site-packages/jupyterlab[I 2022-08-26 04:39:16.990 LabApp] JupyterLab application directory is /home/schroter/newEnv/share/jupyter/lab[I 2022-08-26 04:39:17.004 ServerApp] jupyterlab | extension was successfully loaded.[I 2022-08-26 04:39:17.016 ServerApp] nbclassic | extension was successfully loaded.[I 2022-08-26 04:39:17.020 ServerApp] Serving notebooks from local directory: /home/schroter1[I 2022-08-26 04:39:17.020 ServerApp] Jupyter Server 1.18.1 is running at:[I 2022-08-26 04:39:17.020 ServerApp] http://localhost:8888/lab?token=3c7 75c663666845ac3daf40123db36f7c3520b923c2070f6[I 2022-08-26 04:39:17.021 ServerApp] or http://127.0.0.1:8888/lab?token=3c775c6636 66845ac3daf40123db36f7c3520b923c2070f6[I 2022-08-26 04:39:17.021 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).[C 2022-08-26 04:39:17.039 ServerApp] To access the server, open this file in a browser: file:///home /schroter1/.local/share/jupyter/runtime/jpserver-9483-open.html Or copy and paste one of these URLs: http://localhost:8888/lab?tok en=3c775c663666845ac3daf40123db36f7c3520b923c2070f6 or http://127. 0.0.1:8888/lab?token=3c775c663666845ac3daf40123db36f7c3520b923c2070f6N o protocol specifiedUnable to init server: Broadway display type not supported: unix:0.0Error: cannot open display: unix:0.0 Thanks & Best Regards Schroter Michael ---------------------------------------------------------------------- da_peda · 2022-08-26 15:50 Ok, it seems you're trying a solution that doesn't match your issue. GUI in a Jail doesn't work. You can `ssh -X` into it for X11 forwarding, but that's about it. What exactly are you trying to do? ---------------------------------------------------------------------- Puzzleheaded_Bass_59 · 2022-08-26 23:37 Hi. Thanks for the reply. I wanted to run Jupyter Lab in a python virtual environment. Does this solution use FreeBSD’s browser or do I have to install the browser in the subsystem please Thanks & Best Regards Schroter Michael