You are not logged in.

#1 2018-05-05 17:36:18

ModeFX22
Member
Registered: 2018-05-05
Posts: 1

How do i add my user to sudoers?

Hello, I am having problems with adding my user to sudo gorup.
[modefx@openfire ~]$ gpasswd -a modefx sudoers
gpasswd: group 'sudoers' does not exist in /etc/group
So, I can't use visudo since vi is so complicated and hard to use, Nano or gedit would be good

Offline

#2 2018-05-05 18:02:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,446

Re: How do i add my user to sudoers?

Offline

#3 2018-05-05 18:53:10

vidalstat
Member
Registered: 2018-05-05
Posts: 1

Re: How do i add my user to sudoers?

vim isn't that complicated. open a terminal and type "vimtutor"  You'll thank me.

Offline

#4 2018-05-05 22:14:49

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: How do i add my user to sudoers?

I know I shouldn't, but I use nano and make sure I have the arch-install-scripts installed in case I need to chroot back into my box to repair any damage. This has happened on more than one occasion. Not, I hasten to add, from editing my sudoers file, but for various other inopportune edits of critical system files.

I am not certain, but I believe the the more recent releases of kate, gedit ... and the like, cannot be made to work with gksudo or sudo. This, I believe, is an intentional plot by the developers to protect us from these little follies.

Irvine

Last edited by IrvineHimself (2018-05-05 22:16:45)


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

#5 2018-05-06 02:53:42

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How do i add my user to sudoers?

IrvineHimself wrote:

I know I shouldn't, but I use nano and make sure I have the arch-install-scripts installed in case I need to chroot back into my box to repair any damage. This has happened on more than one occasion. Not, I hasten to add, from editing my sudoers file, but for various other inopportune edits of critical system files.

I am not certain, but I believe the the more recent releases of kate, gedit ... and the like, cannot be made to work with gksudo or sudo. This, I believe, is an intentional plot by the developers to protect us from these little follies.

Irvine

No, it's just a fortuitous side benefit. big_smile

But in all seriousness, gksudo is really old, and anything which uses pkexec still works fine... but it's cheating to use that, ideally things would use polkit the way it is intended for more fine-grained control... for example, gvfs, and therefore gtk3 apps in general, should support admin:///etc/sudoers which uses polkit to get permission to edit the file, using unprivileged GUI apps writing to a virtual filesystem mount admin:///etc/sudoers which is the bit that actually received polkit write privileges.

Just try running

gedit admin:///etc/sudoers

Or changing directories in nautilus or nemo, to "admin:///etc" and then right-clicking a suitable file and selecting the "open with text editor" option.

kate uses polkit directly, not gksudo, though unlike gtk3 apps I believe it is handled directly within kate itself.

The upstream developers have in some cases taught the application to abort early if it detects that it is being run as the root user, on the grounds you shouldn't be running GUI software as root. This doesn't really prevent you from damaging your files, but it does prevent you from damaging other things with them...

Last edited by eschwartz (2018-05-06 02:55:47)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2018-05-06 03:37:58

Cody Learner
Banned
Registered: 2017-12-06
Posts: 54
Website

Re: How do i add my user to sudoers?

+1 on V1del's advice.

Was just trying some unusual stuff with the sudoers file in a Linux container image. Setting the EDITOR variable as in the wiki link, visudo will tell you when you've done something wrong, even when using nano, and it gives you a chance to fix it. Not sure the same behaviour with a gui editor?

I've also used echo "append some stuff" >> /etc/sudoers in scripts. but the appended stuff was tested prior. I'd definitely not advise trying this on anything you depend on.

There's always ways around dev's looking out to protect us from ourselves. I think it depends on how bad you want to break stuff. (attempted humour)

admin:///etc/sudoers, interesting. Now I'm off to try it...

Last edited by Cody Learner (2018-05-06 03:59:36)


Self designated Linux and Bash mechanic.....
I fix and build stuff hands on. I'm not opposed to creating a mess in obtaining a goal.

Offline

#7 2018-05-06 03:49:17

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How do i add my user to sudoers?

Cody Learner wrote:

I've also used echo "append some stuff" >> /etc/sudoers in scripts. but the appended stuff was tested prior. I'd definitely not advise trying this on anything you depend on.

That script must run with sudo, then, since >> is a shell redirection and runs with the same permissons as your shell. wink

I strongly suggest at the least using a temporary file, e.g.  { cat /etc/sudoers; echo "append some stuff"; } | install -Dm440 /dev/stdin /etc/sudoers.temp, followed by visudo --check --file=/etc/sudoers.temp to verify the new file works okay, then moving the temporary file over (note the manual setting of permissions). This (--check) is exactly what visudo without options uses, except it also wraps $EDITOR instead of cat + echo.


EDIT: fixed install(1) usage

Last edited by eschwartz (2018-05-06 04:19:00)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2018-05-06 04:07:07

Cody Learner
Banned
Registered: 2017-12-06
Posts: 54
Website

Re: How do i add my user to sudoers?

Thanks Eschwartz! I'll study that until I get my head around whats going on with it. And yes on the sudo..

Last edited by Cody Learner (2018-05-06 04:07:54)


Self designated Linux and Bash mechanic.....
I fix and build stuff hands on. I'm not opposed to creating a mess in obtaining a goal.

Offline

#9 2018-05-06 04:38:56

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: How do i add my user to sudoers?

Cody Learner wrote:

..... There's always ways around dev's looking out to protect us from ourselves. I think it depends on how bad you want to break stuff....

If you don't periodically break critical files, your not learning anything, and, by the way, would probably be better of with Ubuntu or Windows. wink

A case in point being this thread, which I am going to bookmark.

Irvine


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

#10 2018-05-06 07:32:47

seth
Member
Registered: 2012-09-03
Posts: 64,113

Re: How do i add my user to sudoers?

vim is actually an NSA tool, used to create perfect entropy for their keys ... (and there's probably a hall of printouts w/ the most funny exit attempts)
https://stackoverflow.blog/2017/05/23/s … -exit-vim/

smile

Seriously, though: vi(m) is not "too complicated" - it's different from the later established user interfaces, but if you intend to deal w/ *nix environments, you're better off learning at least the core stuff, and: there's help!
https://mrpizzalust.deviantart.com/art/ … -537590169

Offline

#11 2018-05-06 17:19:12

Cody Learner
Banned
Registered: 2017-12-06
Posts: 54
Website

Re: How do i add my user to sudoers?

An empirical evidence based fact burned into my neural network for the last 9 years: vi is a linux virus that took control of my computer, forcing me to press the power button to regain control.
https://dojo.stuycs.org/resources/_images/vim-meme.png

The fact remains, yet my perspective has changed:
https://qph.fs.quoracdn.net/main-qimg-1 … 458a7075-c
https://www.thefamouspeople.com/profile … lius-3.jpg

Need to get cost to have this printed as a poster to put on wall behind monitor:
https://i.redditmedia.com/iigrixvxp5aYN … b79bdd8978


Self designated Linux and Bash mechanic.....
I fix and build stuff hands on. I'm not opposed to creating a mess in obtaining a goal.

Offline

#12 2018-05-06 19:00:19

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: How do i add my user to sudoers?

Way back in the day, I remember ed and sed as being ubiquitous. In fact, as I recall, when the early forerunners of today's Pc's first started to put the OS, (usually DOS,) onto floppy discs, the only way to edit the configuration and autoexec files was with ed/sed like clones. When Wordstar, (on which nano is modelled,) was released, most people didn't believe things could get any better.

The upshot is, that reading these observations about vim just makes me shudder.

Irvine

Last edited by IrvineHimself (2018-05-06 19:06:13)


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

#13 2018-05-06 20:22:41

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,446

Re: How do i add my user to sudoers?

This likely has derailed enough for now, the answer the OP seeks is readily available in the second post and the other answers only steer it into an unrelated direction on editors which was never the focal point.

Closing.

Last edited by V1del (2018-05-06 20:24:50)

Offline

Board footer

Powered by FluxBB