How to leave a user non-root to use sudo

B

BSDAppentic3

Guest
"I must give permissions to my account that isn't root. What should I do?"
There are tutorials that explain it very well. It is something very basic.
So, let's begin: firstly, you must edit the /usr/local/etc/sudoers using
Code:
 nano
Add this line:
Code:
 user_name ALL=(ALL) ALL
: here "user_name" it's the name of the other account. Replace it by the name of your user non-root.
Press Ctrl+x and save the changes.
Now, go to the login shell. Log with your name and password of your other account.
Type sudo and see what happens.
Bye.
Edit: In case that you don't know how to open a tty, just press ctrl+alt+f2. There you can login.
Edit2: Don't make this unless you understand the risks.
 
Don't edit /usr/local/etc/sudoers by hand, use visudo(8). The command respects the EDITOR environment variable. The reason is that visudo(8) does a proper syntax check before applying your changes, so you can never create a broken configuration. It's also safe to use in case more than one person decides to edit sudoers at the same time.
 
Don't edit /usr/local/etc/sudoers by hand, use visudo(8). The command respects the EDITOR environment variable. The reason is that visudo(8) does a proper syntax check before applying your changes, so you can never create a broken configuration. It's also safe to use in case more than one person decides to edit sudoers at the same time.

I should advice that this it's only for who that accept the risks.
Of course I already know the method that you are talking about, but I fight every time to try to save the changes inside that editor.
I prefer nano, so if you could tell me a method in which I can use that (or ee), I'll be really glad.
 
If the user it's a member of wheel group you just need to uncomment the following line:
Code:
 %wheel ALL=(ALL) ALL
otherwise you need to grant that user root privileges.
 
If the user it's a member of wheel group you just need to uncomment the following line:
Code:
 %wheel ALL=(ALL) ALL
otherwise you need to grant that user root privileges.
Why? Why only doing that? But I'm not giving permissions of root to the another account following this.
Which is best? That the user have root access, or the method about which you wrote?
 
Why? Why only doing that? But I'm not giving permissions of root to the another account following this.
Which is best? That the user have root access, or the method about which you wrote?

Adding a user in /usr/local/etc/sudoers you are giving them root privileges.

(e.g. user_name ALL=(ALL) ALL)

and that's a problem because having a user with root privileges it's a risc situation. So if you use the method I recommended you only grant that user or group the ability to run some or all commands as root for a limited period of time (5 minutes).
More about sudo/sudoers here.
 
Minbari Sorry but I can't give access to my other account following your method.
It says that the user isn't in the sudoers file.
 
Minbari Okay. Now I hadn't xorg, for some reason, when I type startx, it says "unknown command". I think that it was someone that has access to my equipment, or some virus, and like my system has root access, the virus/hacker can do it. It can be paranoia? Perhaps. But I know that there're some kind of viruses that can do this (even when they have root access, although, it is not necessary in a few cases).
I follow your method, but as a I'm an incompetent using vi, I opted for use nano.
 
Minbari Okay. Now I hadn't xorg, for some reason, when I type startx, it says "unknown command". I think that it was someone that has access to my equipment, or some virus, and like my system has root access, the virus/hacker can do it. It can be paranoia? Perhaps. But I know that there're some kind of viruses that can do this (even when they have root access, although, it is not necessary in a few cases).
Or you just delete it form mistake?

I follow your method, but as a I'm an incompetent using vi, I opted for use nano.
You don't have to use vi/vim, nano () it's fine just add nano to your shell rc file (.cshrc/.zshrc/.bashrc).. e.g:
Code:
export EDITOR=nano
 
Or you just delete it form mistake?
Are you serious dude? Why the h3ck should I delete Xorg? It works fine.
At least that I have uninstalled it uninstalling another program. But still...it is very strange...
 
Back
Top