question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In GUI the user Elevate to root not working

See original GitHub issue

In Debian 10 python 3.7.3 and ajenti 2.1.37. After manual fresh minimal install with the below authentication configuration in the config.yml : auth: allow_sudo: true provider: os user_config: os I authenticated successfully a none root user and want to Elevate to root, but not working. I got an authentication error and two unhandled exceptions pop-up. I found in ajenti/ajenti-core/aj/auth.py the class AuthenticationService(): def check_sudo_password(self, username, password): function handling authentication and use the sudo. The unhandled exceptions occur when the o, e = sudo.communicate(password + '\n'), because the communicate function parameters are must be bytes and it returns bytes. These changes solved the unhandled exceptions:

o, e = sudo.communicate(input=(password + '\n').encode('utf-8'))
...
raise SudoError((o + e).encode('utf-8').splitlines()[-1].strip())

My second problem was the sudo. In Debian 10 the sudo validates the invoking user’s credentials by default not the target user credentials. In the aj is sending target user credentials, but the sudo runs with the aj server process user, like “nobody” in my case. In defaults the “sudoers” does not contain “nobody” user settings and has no password. Therefore, authentication cannot be successful. In my case the sudo command gets “nobody” user password and it runs “ls” with “<username>” privileges. What was the purpose of using sudo -S -k -u <username> -- ls?

To make sudo authentication work I added the following lines to the “sudoers” file:

Defaults:nobody targetpw
nobody  ALL=(ALL) /bin/ls

The first line enables the target user authentication to “nobody” user.

I hope I could help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kiarncommented, Mar 26, 2021

Hello @dsonbill

I forgot this one. I think changing :

o, e = sudo.communicate(password + '\n')

onto

o, e = sudo.communicate(password.encode('utf-8') + b'\n')

in /usr/local/lib/python3.6/dist-packages/aj/auth.py at line 158 ( and then restart Ajenti ) should do the trick.

Regards

Arnaud

0reactions
kiarncommented, Jun 22, 2021

Hello @CyberCyclone

It’s normal to have to give the password again. If you can post some errors from /var/log/ajenti/ajenti.log I can have a look at it. New version should come soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

desktop environments - How to run a complete GUI as root?
The first steps to set root password remain the same, obviously. Using command, sudo passwd root to set a new root password. It's...
Read more >
How to allow GUI root login on Ubuntu 20.04 Focal Fossa ...
In this article you will find out how to allow the root user to login to GUI gnome Desktop on Ubuntu 20.04 Focal...
Read more >
Running GUI applications as root
To edit files as root, use sudoedit. GVFS. Access to privileged files and directories is possible through GVFS by specifying the admin backend ......
Read more >
How to operate as root in GUI?
Press Alt F2 to run a command and then enter gksu nautilus (using gksu is the recommended way to open GUI's with root...
Read more >
How to enable the root user or change the root password ...
To enable the root user, choose Edit > Enable Root User from the menu bar. Then enter the password that you want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found