jail-shell
jail-shell copied to clipboard
Is there a way to execute /bin/bash as user and enter the jailed environment?
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.
change user default shell with following command:
chsh -s /bin/bash username
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.