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

multiple users and 1-to-1 mapping ? #143

Open
wholeinsoul opened this issue May 21, 2015 · 4 comments
Open

multiple users and 1-to-1 mapping ? #143

wholeinsoul opened this issue May 21, 2015 · 4 comments

Comments

@wholeinsoul
Copy link

Is it possible for a single tty.js server to support multiple users with each user mapped to a unique linux user ? Currently it seems all the users access the same linux user's shell.

I have userZ running the tty.js server and two users userA, userB specified in config.json. But both userA and userB end up having the access to userZ's shell [whoami returns userZ for both userA and userB]. How can I map userA to linux userA's shell and userB to linux userB's shell ?

One solution I can think of is to specify a custom shell in config.json "shell" : "my_shell_script" that logins into the appropriate user shell.

Thank you

@chjj
Copy link
Owner

chjj commented May 21, 2015

Not right now, but pty.js has the ability to set the uid and gid of the forked process. So, it is technically possible to map each browser user to a unix user if implemented right. I think this is a good idea and shouldn't be too difficult to implement. Will accept PRs.

That being said, you could also set the default shell to a unix login. That way users would just login using the terminal. I haven't tested it myself, but I've heard of people doing it.

@wholeinsoul
Copy link
Author

Thank you. I was also thinking of the unix login shell approach.

@davicompu
Copy link

chjj I would like to know how to setup tty.js or the inside implementation of pty for the default unix login. I'm currently running tty.js project because of the express server.

@risacher
Copy link

FWIW, I had trouble getting tty.js to use the default unix login, so set my shell parameter to be a tiny script that I call 'ssh-localhost' which looks like this:

#!/usr/bin/perl
print "Login: ";      
my $username = <STDIN>;
chomp $username;        
$username =~ s/[^a-z]//g;
exec ("/usr/bin/ssh -e none $username\@localhost"); 

This allows me to use tty.js to login as any user on the local host where tty.js is running.

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

4 participants