jail-shell icon indicating copy to clipboard operation
jail-shell copied to clipboard

Is there a way to execute /bin/bash as user and enter the jailed environment?

Open jaimbh opened this issue 2 years ago • 2 comments

Is there a way to execute /bin/bash as user and enter the jailed environment? Basically I need a command to enter /bin/bash when stepping down as user using posix_setuid.

jaimbh avatar Jan 10 '23 12:01 jaimbh

change user default shell with following command:

chsh -s /bin/bash username

pymumu avatar Jan 10 '23 15:01 pymumu

This did not work. Actually I am using ttyd web terminal that I installed from github. When I step down as user and login to ttyd web terminal, I am able to see other users' home directories and also enter them using cd command even when the user is jailed.

I enter the ttyd terminal from my php script where I call: exec(SOMEPATH/bin/ttyd --once -u UID_OF_USER -g GID_OF_USER -P 10 -b /tty/ -i dir/username sock /bin/bash);

Adding su with this command like mentioned below works but it asks for password in the web terminal which I dont want. exec(SOMEPATH/bin/ttyd --once -u UID_OF_USER -g GID_OF_USER -P 10 -b /tty/ -i dir/username sock su username);

After using su I am able to login as a jailed user but I have to enter password in the terminal to login. I am looking for a solution where the user gets logged in without password.

https://github.com/tsl0922/ttyd

jaimbh avatar Jan 11 '23 11:01 jaimbh