Control Web Panel
WebPanel => FTP => Topic started by: hanliong on June 15, 2021, 06:20:07 AM
-
I tried to use jailkit for a user in CWP.
It create directory /home/jail/[user]/home/[user]
But after waiting for minutes, the page at CWP admin said: Error enabling jailkit.
I then switch to SFTP, and no problem.
But the problem is that I cant remove /home/jail/[user]
If I removed it, it automatically remove /home/[user] too. It looks like /home/[user] is symlinked to /home/jail[user]
If I remooved file inside /home/jail/[user], it removed the file inside /home/[user] too.
I tried to remove that symlink. But I cant find it.
Even, I have uninstall jailkit, but still unable to remove /home/jail/ and the symlink still run.
How to fix it? where is the symlink configuration store?
Thanks.
-
I saw when selecting Jailkit In shell access at CWP Admin, there is a file careated name:
/run/systemd/generator/home-jail-[user_cwp]-home-[user_cwp].mount
It looks like mount the hard disk, so I checked at /etc/fstab, and I found this line
/home/[user_cwp] /home/jail/[user_cwp]/home/[user_cwp] none bind,nobootwait 0 0
It causes the /home/[user_cwp] has symlink to /home/jail/
So, how can I unmount this since I have disabled jailkit, because it was error when trying to use it.
Thanks.
-
After reviewing for days, I can figure out to fix the symlink of /home/[user] to /home/jail/[user]/home/[user] in cse jailkit failed to be enabled for a user.
Everytime we enable jailkit for a user, it will add a new line in
/etc/fstab/
the new line is like this
/home/[user_cwp] /home/jail/[user_cwp]/home/[user_cwp] none bind,nobootwait 0 0
And it also automatically create file
/run/systemd/generator/home-jail-[user_cwp]-home-[user_cwp].mount
/run/systemd/generator/local-fs.target.requires/home-jail-[user_cwp]-home-[user_cwp].mount that symlink to /run/systemd/generator/home-jail-[user_cwp]-home-[user_cwp].mount
It causes we cant remove /home/jail/user when we do not use jailkit anymore. And everytime we reboot the server, the /home/jail/user will be created automatically.
So, to fix this issue, just follow this step
rm -rf /run/systemd/generator/home-jail-[user_cwp]-home-[user_cwp].mount
rm /run/systemd/generator/local-fs.target.requires/home-jail-[user_cwp]-home-[user_cwp].mount to remove the symlink
vi /etc/fstab
add comment (#) before /home/[user_cwp] /home/jail/[user_cwp]/home/[user_cwp] none bind,nobootwait 0 0 or delete that line
reboot server
Now /hom/jail/[user] will not exist anymore.
Remember, it just in case jailkit error when enabling for a user. You do not need to do this if jailkit is enabled successfully. It it enabled successfully, it will remove the line at /etc/fstab/ and /home/jail/[used] when you disable jailkit for that user.
Hope it helps.
-
Thanks a lot. really help me to solved this.