An easy way to setup sudo

Added by sadegh nazari 3 months ago

Hi,
since a few day ,I try to setup sudo ,to be root,to could use Porthole portage,but it seems not easy for me. Now I can not -for example-install Redshift,or use terminal becouse I am not root.What sould I do?


Replies (18)

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

terminal > su > password = root

RE: An easy way to setup sudo - Added by Jose Jurado 3 months ago

Hi Sadegh,

Someone has already offered useful help, thankfully! I had already been preparing my answer, so here it is also, in case it can help further:

Hopefully you were allowed 'administrative' rights when the system was installed so that you can become root and have root's password. Otherwise, whoever is root would have to do the following for you. If you do have the right to use root's password, then you can obtain sudo rights by doing the following. Log in as usual and then, in a terminal, you will be asked for the (root's) password when you do su - as follows:-

su -
visudo

Then you will need to remove the # (hash symbol) at the following line:-

# %wheel     ALL=(ALL)      ALL

Calculate Linux typically uses wheel instead of sudo to check whether you have sudo rights, so that is why we change the 'wheel' line.

Visudo uses vim editor by default, which may not be very intuitive. You can follow a guide to use visudo here or here to learn how to remove the hash symbol and save the file edited by visudo.

If you still are unable to use visudo with its vim editor, you could try to install nano editor, which is easier, and set it as the visudo editor. Still as root; update your system first:

cl-update
emerge nano
EDITOR=nano visudo
visudo

Then, carefully use the delete key to delete the hash symbol described above, type Ctr+o to save the change, and then Ctr+x to exit. If there was an error, visudo may report it to you. Otherwise, you have enabled anyone with sudo rights the ability to use sudo now.

Next, do you have sudo rights? Check by substituting in your username in the following:-

id yourusername

If (wheel) appears, among other terms, then you are in the wheel group, which implies that you have sudo rights. Otherwise, add yourself there:-

usermod -a -G wheel yourusername

If usermod is not recognized, install its package first: emerge sys-apps/shadow.

Reboot next before checking whether sudo works, and then let us know if it does.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

I do not understand what the problem is, I start Porthole portage in this way:
I am localized on my unsupported Serbian language my KDE-Calculate
LC_ALL=C sudo porthole or sudo porthole
or
LC_ALL=C kdesu porthole or kdesu porthole

If you want to install Porthole it can from the terminal:
su
your_password
eix porthole
[I] app-portage / porthole
Available versions: 0.6.1-r5 {tbz2} {nls PYTHON_TARGETS = "python2_7"}
Installed versions: 0.6.1-r5 {tbz2} (03:20:02 30.08.2018.) (Nls PYTHON_TARGETS = "python2_7")
Homepage: http://porthole.sourceforge.net
Description: A GTK + -based frontend to Portage

emerge app-portage/porthole

sys-apps/shadow is installed

https://i.postimg.cc/sxPPrPws/1-124.png

RE: An easy way to setup sudo - Added by sadegh nazari 3 months ago

sadegh@calculate ~ $ usermod -a -G wheel sadegh
usermod: kan /etc/passwd niet openen
usermod: ontgrendelen van /etc/passwd is mislukt
sadegh@calculate ~ $

Strange. I just installed and can use "Redshift",with: emerge redshift,and I have got "Porthole" now,but it is not root.That meens I can not use it.

RE: An easy way to setup sudo - Added by sadegh nazari 3 months ago

Thanks Dragan,

I have got porthole but it is "Not Root". How can I fix this?

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

Start the menu if there is a Porthole launcher? If it exists, edit it to write: sudo porthole. The next step is to start the porthole from the menu, if it starts, then the synchronization button should be selected. Only after the synchronization can a program be search by name and if it is installed on the emerge button. Then a window opens in which additional parameters can be set. So I installed programs through the terminal as I already described.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

I do not understand why Jose Jurado suggested that you edit something. When I installed the KDE-Calculate distribution, I had sudo, kdesu and su. I did not interact with the visudo, maybe it's necessary in XFCE. I have the update lanser in menu or it works update from the terminal: 1. su 2. password 3. eix-sync 4. dispatch-conf 5. cl-update

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

I looked at me and I do not have an intuitive nano editor. Visudo I had the problem of getting out of the editor, everything that does not work. I installed nano and nano
/etc/sudoers
, comes out of nano with ctrl + x. user whell is not changed.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

I do not know why you want to be root?
If you want to be a root user then log in when booting the user's system: root, password: root_password. In KDE Plasma when you log in I have a GUI mode, plasma developers made a mistake, I do not know about XFCE.
Do you have sudo installed, check, emerge sudo. You must remember that sudo is a command that gives you temporary root authority. Every action on system files searches for sudo. Prothole works with system files and therefore must start sudo porthole either from the terminal or with the launcher program in the menu.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

Terminal
Ordinary user
dragan@calculate ~ $

user with root privileges
dragan@calculate ~ $ su
Лозинка:
calculate /home/dragan #

RE: An easy way to setup sudo - Added by Jose Jurado 3 months ago

dragan legic wrote:

I do not understand why Jose Jurado suggested that you edit something. When I installed the KDE-Calculate distribution, I had sudo, kdesu and su. I did not interact with the visudo, maybe it's necessary in XFCE.

Correct. In a recent Calculate Linux 18 xfce version at least, sudo is not completely enabled. The request is for An easy way to setup sudo, which requires editing the sudoers file.

sadegh nazari wrote:

sadegh@calculate ~ $ usermod -a -G wheel sadegh
usermod: kan /etc/passwd niet openen
usermod: ontgrendelen van /etc/passwd is mislukt

Unless your system was modified otherwise, the prompt on your system ($) demonstrates that you were not doing the instruction as root. You need to execute the instruction as root; the prompt will typically include a #, as shown by dragan's latest post.

The prompt and instructions should include the following:-

$ su -
# usermod -a -G wheel sadegh

sadegh nazari wrote:

Strange. I just installed and can use "Redshift",with: emerge redshift,and I have got "Porthole" now,but it is not root.That meens I can not use it.

You may have installed redshift as root and then tried installing something using porthole without root privileges somehow. Consider dragan's instructions. Let us know how it went.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

@Jose Jurado,
Today I tried to install something Porthole is useless. I installed a new kernel from Porthole yesterday. From your writing, I see that sudo and kdesu are changed so that I do not even know if Porthole is useful. I do not like returning to manual controls in the terminal, occasionally but not permanently. When I start Porthole from the terminal and # LC_ALL = C porthole I get Porthole GUI but now I tried to install something and the execution buttons do not respond. I have a similar situation with plasma-discoveries in Neon distribution, the program is for updating, and now there is nowhere to be found any button for execution, it's gone...

RE: An easy way to setup sudo - Added by Jose Jurado 3 months ago

Hi dragan!
Generally, I prefer using the terminal to search and install packages. I haven't used porthole to install anything and am not familiar with it. Anyway, doing a quick search on the internet about porthole install packages or so, you could find some discussion about how to use porthole using xhost localhost or xhost +localhost, for example, here or here . Note the comment in last link about a requirement to be in the portage group, but I can't confirm this. Searching the Gentoo forum, particularly, might be useful.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

Too complicated, I read what you linked and I do not understand. I read Gentoo does not support multilib, and there are writes for the x86-based ports, I use all amd64 and it's not clear to me if it does not support multilib how it works. For months, teamviewer does not work with me, does not work with my friend who uses XFCE and we have no solution, we asked support, the answer was that the program worked for support. I just installed anydesk, the only way to run the program from the menu is sudo rc-service anydesk restart.
The launcher that installs the installation does not work.
Thanks for the answer :)

RE: An easy way to setup sudo - Added by Jose Jurado 3 months ago

Try:

$ sudo emerge lxqt-sudo 
$ lxqt-sudo porthole

You will be asked for your user password for both instructions. On my Calculate Linux xfce, I was able to remove ('unmerge') and install a package (htop) successfully today that way. Another dialog box pops up showing progress. It's best to click 'Sync' first to update the system.

Dagan, your investigations with kdesu porthole sounded smart to me because that may be a reasonably safe way to launch lxqt-based packages (and qt- or gtk-based packages?) using sudo rights in KDE environments. Before passing on porthole, therefore, I figured I would try the lxqt-sudo variant as above, as it doesn't pull as many dependencies in my non-kde environment.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

@Jose Jurando

I think sudo and lxqt-sudo same, lxqt-sudo is based on sudo, look at the pictures

RE: An easy way to setup sudo - Added by Jose Jurado 3 months ago

Dragan,
Not quite. Sudo is not the same as gksudo or kdesudo, which is similar in function to lxqt-sudo. Thanks for your graphic, but users should be aware of the differences and avoid sudo (or running as root) when using packages, such as porthole, that do not run with CLI or ncurses:

https://help.ubuntu.com/community/RootSudo#Graphical_sudo
http://www.psychocats.net/ubuntu/graphicalsudo

Last time I checked, gksudo was being phased out. Lxqt-sudo may be a suitable alternative, but I haven't looked a lot into that.

RE: An easy way to setup sudo - Added by dragan legic 3 months ago

@Jose Jurando,

Thanks for the links, I read it all long ago, but now I do not believe anything I read. As far as I know when I started to use linux there were: su, gksu, gksudo, sudo, kdesu, kdesudo. Now after so many years it is revealed that something is dangerous, the commands are abolished. The best show is Dolphin, who is favored instead of Krusader. Now Krusader can work in root mode and Dolphin can not. After 10 years, Dolphin was discovered to be dangerous. When I look at the system setting my account can be used as an administrator, which is the difference between administrator and root, I can destroy my system as an administrator. I honestly think that no one else knows how linux works and how some program affects the other program and the whole system. User support is terrible, the best example is Neon that makes the plasma and where the developers angry if a user suggests or writes that there is a problem like now that there is no update button in the update program. Distribution authors play kernel versions (kernel in ubuntu 18.04 it is EOL on kernel.org), play with versions of python 2.7 - 3.7, graphical environments, etc ...
Best wishes, Dragan :)

(1-18/18)

Thank you!