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

User other than root #9

Closed
mukhtharcm opened this issue Sep 9, 2020 · 9 comments
Closed

User other than root #9

mukhtharcm opened this issue Sep 9, 2020 · 9 comments

Comments

@mukhtharcm
Copy link

How to create a user other than root in proot ubuntu?
I really dont want to mess up with my installation.

@ghost
Copy link

ghost commented Sep 9, 2020

How to create a user other than root

useradd, then su/sudo for switching.

@ghost ghost closed this as completed Sep 9, 2020
@mukhtharcm
Copy link
Author

How to create a user other than root

useradd, then su/sudo for switching.

Is there any way to directly login to non root user?

@ghost
Copy link

ghost commented Sep 10, 2020

It's simple. you need to add the login command inside .bashrc file

eg:
echo "exec su - username" >> .bashrc

But I'm not sure there's a chance that if you type exit it keeps logging in back

@ghost
Copy link

ghost commented Sep 10, 2020

Is there any way to directly login to non root user?

I hope you have read the help information of proot-distro login - this command allows to redefine login command and use something else instead of just root shell.

Try something like proot-distro login ubuntu -- su - username

@jj-sallo
Copy link
Contributor

Try something like proot-distro login ubuntu -- su - username

This will result in tty errors, making it impossible to use programs like emacs and breaking things all around.

For example, trying to start emacs results in: emacs: Could not open file: /dev/tty

you need to add the login command inside .bashrc file

This works, but only when --termux-home is not specified.

Maybe adding a flag to login that switches --root-id to --change-id=uid:gid is a better option?

@ghost
Copy link

ghost commented Nov 18, 2020

This will result in tty errors

On your device maybe. Never seen such issue on any of mine.

trying to start emacs results in: emacs: Could not open file: /dev/tty

I can't reproduce that. Emacs works perfectly as well as /dev/tty accessible. See below:
screen

Maybe adding a flag to login that switches --root-id to --change-id=uid:gid is a better option?

su handles things better.

@jj-sallo
Copy link
Contributor

jj-sallo commented Nov 18, 2020

Seems like it's specific to Ubuntu-18.04.

Screenshot_20201117-204434~2

Worked fine in Ubuntu 20.04. Haven't tried other distros.

I also tried to add a --user flag to login as described before and it worked fine in Ubuntu-18.04. Will upload a fork to Github soon.

Why is su preferred, if I may ask?

@ghost
Copy link

ghost commented Nov 18, 2020

Why is su preferred, if I may ask?

Because su is alternate implementation of /bin/login, transparently configures appropriate environment vars for user and handles PAM modules.

@vmobilez
Copy link

vmobilez commented Aug 12, 2021

proot-distro login --user username distro

example username eric, distro ubuntu-20.04

proot-distro login --user eric ubuntu-20.04

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants