Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Jan 10, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 10, 2023

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.

@ghost ghost changed the title Is there a way to execute /bin/bash as a user but in jailed environment? Is there a way to execute /bin/bash as user and enter the jailed environment? Jan 10, 2023
@pymumu
Copy link
Owner

pymumu commented Jan 10, 2023

change user default shell with following command:

chsh -s /bin/bash username

@ghost
Copy link
Author

ghost commented Jan 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant