-
Notifications
You must be signed in to change notification settings - Fork 40
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
Question: How to run as user #9
Comments
To open new shell and switch to it run: |
Hi @legionus , |
@Witko /proc mounted? |
|
Hm... it means that we could not find the process on this tty. https://github.com/legionus/kbd/blob/master/src/openvt.c#L131-L139 |
Is it something that can be fixed/changed? |
@Witko Do you have |
I dont |
In this case I do not know how to find owner of current console. Sorry. |
Cant you use sth like whoami? |
@Witko ehhh... No. If you run openvt under sudo, then the whoami response is
|
What about this?
|
No. This looks ugly. Also, it doesn't work on my laptop:
|
It is only an idea which worked for me and potentially could be a different approach how to resolve the owner of tty and solve the problems with openvt. So please look at it from this side and don't judge the beauty. |
Can you show me output |
|
and you do not have any process on tty1 ? |
when running ps i can see:
|
Wait, why you don't use |
@legionus im using xinit |
As per this answer https://stackoverflow.com/a/25281113 (the last third example), running script with |
|
He has made a user-friendly application for laptops which has two graphics card, where at least one is NVIDIA Graphics card. NVIDIA calls these type of laptops as Optimus laptop. Nowadays, these type of laptops accounts for most "gaming laptops". His program is called nvidia-xrun, see his repository. It's the only universal way -- working on all distros -- of playing games on Linux in these gaming laptops. Now, let us build up a situation. Imagine that you are a new Linux user and want to play some cool games, but you, unfortunately, have an Optimus laptop. In such case, it would be intuitive not to log out your session in order to play your game, right? Changing TTY to, then, execute in the new command line code for playing the cool game would be even weirder. It's not about his concern, it's about a concern of a lot of Linux users, as such the ones here. Hence, being able to execute
without root permissions, have good practical applications. That's why he can't just on another TTY
After this explanation, does this is being further investigated? What could be done to have the functionality work? |
Guys, Something like that: read -r uid < /proc/self/loginuid ||:
chown -h "$uid" "$(tty)";
exec sudo -u "#$uid" "$@" Instead of sudo in this script, you can use |
Wow! Quite involved command. Thanks for that. I will try to use the same ideas in the script. |
Another solution may be make a user be a member of |
Hi,
im trying to run command with openvt from running X session. When i run:
openvt bash
i get:
openvt: Unable to open /dev/tty5: Permission denied
when i run:
sudo openvt bash
i end up running the bash as root. Ultimately i want to be able to run openvt xinit... as logged user.
This should be possible to do with:
sudo openvt -u bash
but then i get:
openvt: Couldn't find owner of current tty!
if i try:
sudo openvt -- sudo -i -u ${user} xinit ...
then the x will crash on not having access to the vt.
Is it possible to do this?
The text was updated successfully, but these errors were encountered: