Can'tedit anything-Sudoers file? [SOLVED]

You have a problem with Salix? Post here and we'll do what we can to help.
travalon
Posts: 10
Joined: 27. Jun 2012, 07:22

Can'tedit anything-Sudoers file? [SOLVED]

Post by travalon »

I have attempted a couple of things on my new install of Salix. Nothing has worked. I am a noob to linux in general and a super noob to Salix. The thing I am trying to do at the moment is edit my conky config file. I can open it and edit it but I can't save it. Also when I try to do things in the terminal I get a "not in the sudoers file" followed by a threat to report me to me, as I am the sole user of this machine. I would like to add myself to the sudoers file but I don't know where it is or how. I believe if I get into the sudoers club things will be fine for a while.
Last edited by travalon on 14. Jul 2012, 15:34, edited 1 time in total.
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: Can'tedit anything-Sudoers file?

Post by Tim CowChip »

you might try gksu or kdesu.

Code: Select all

gksu leafpad

Code: Select all

kdesu kwrite
ImageImage
User avatar
gapan
Salix Wizard
Posts: 6349
Joined: 6. Jun 2009, 17:40

Re: Can'tedit anything-Sudoers file?

Post by gapan »

travalon wrote:I have attempted a couple of things on my new install of Salix. Nothing has worked.
Without stating exactly what you attempted to do, nobody can help you.
travalon wrote:The thing I am trying to do at the moment is edit my conky config file. I can open it and edit it but I can't save it. Also when I try to do things in the terminal I get a "not in the sudoers file" followed by a threat to report me to me, as I am the sole user of this machine. I would like to add myself to the sudoers file but I don't know where it is or how. I believe if I get into the sudoers club things will be fine for a while.
Too many problems with this one. First, you have a lack of understanding file ownerships and permissions. It's obvious that you don't have permissions to edit that file you're talking about. Here's a quick introduction: http://www.tuxfiles.org/linuxhelp/filepermissions.html

Since you say it's a conkyrc file, I doubt it's a system file. It's most probably a file that you used in a previous /home directory, created with another distribution, using different user credentials (most importantly UID).

Now, about the "sudoers" thing. The answer to how do you get into the sudoers club, is "run visudo as root, so you can edit the sudoers file". But I don't think that's what you expected. Also, here's an FAQ on that: http://polishlinux.org/first-steps/root ... /sudo-faq/

Why are you trying to use sudo? And how do you think it would work? This is not ubuntu. sudo is not configured by default the same it is configured in ubuntu and thus it cannot be used by default the same way as it does in ubuntu. You can in fact configure it the same way, but you need to understand what you're doing and do it yourself. In slackware/salix, the su command (or gksu or kdesu for the graphic equivalents) is used to login as the root user and run commands as that user.
Image
Image
macondo
Posts: 90
Joined: 16. Jun 2011, 02:08

Re: Can'tedit anything-Sudoers file?

Post by macondo »

travalon wrote:I have attempted a couple of things on my new install of Salix. Nothing has worked. I am a noob to linux in general and a super noob to Salix. The thing I am trying to do at the moment is edit my conky config file. I can open it and edit it but I can't save it. Also when I try to do things in the terminal I get a "not in the sudoers file" followed by a threat to report me to me, as I am the sole user of this machine. I would like to add myself to the sudoers file but I don't know where it is or how. I believe if I get into the sudoers club things will be fine for a while.
I'm a noob too when it comes to Slackware/Salix. I'll try to explain the way i did it.

1. To edit most files in Linux you have to be ROOT, except if the file belongs to you (if it is in the /home file) then you can do it as travalon (user). Clear as mud?

2. You are trying to edit your .conkyrc file which is a "dot file" and is in your /home directory, therefore, you can do this as 'user'.
Example:

Code: Select all

$ nano .conkyrc
edit the file and then save and exit.
Control + o  saves the file
Control + x  exits the editor nano
Done!
To belong to the sudo group, i did this:
The file /etc/sudoers is outside your /home, thus you have to become ROOT, launch a terminal:

Code: Select all

$ su
password: type here your root password
and you become ROOT when you see the hash mark (#)
Now you're ROOT and can edit the /etc/sudoers file:

Code: Select all

# nano /etc/sudoers
edit, adding the line you want to the file.
(i added myself to the group 'wheel' and uncommented the line for those belonging to that group)

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL
save/exit
Edit your .bashrc as user

Code: Select all

$ nano .bashrc
and add this line:
export PATH=/sbin:/usr/sbin:$PATH
save/exit
#reboot

when you come back try using sudo:

Code: Select all

macondo[~]$ sudo slapt-get -u
    Retrieving package data [http://salix.enialis.net/i486/slackware-13.37/]...Cached
    Retrieving patch list [http://salix.enialis.net/i486/slackware-13.37/]...Cached
    Retrieving checksum list [http://salix.enialis.net/i486/slackware-13.37/]...Done
    Retrieving checksum signature [http://salix.enialis.net/i486/slackware-13.37/]...Cached
    Verifying checksum signature [http://salix.enialis.net/i486/slackware-13.37/]...No key for verification
    Retrieving ChangeLog.txt [http://salix.enialis.net/i486/slackware-13.37/]...Cached
    Reading Package Lists...Done
    Retrieving package data [http://salix.enialis.net/i486/slackware-13.37/extra/]...Cached
    Retrieving patch list [http://salix.enialis.net/i486/slackware-13.37/extra/]...Done
    Retrieving checksum list [http://salix.enialis.net/i486/slackware-13.37/extra/]...Done
    Retrieving checksum signature [http://salix.enialis.net/i486/slackware-13.37/extra/]...Cached
    Verifying checksum signature [http://salix.enialis.net/i486/slackware-13.37/extra/]...No key for verification
    Retrieving ChangeLog.txt [http://salix.enialis.net/i486/slackware-13.37/extra/]...Done
    Reading Package Lists...Done
    Retrieving package data [http://salix.enialis.net/i486/13.37/]...Cached
    Retrieving patch list [http://salix.enialis.net/i486/13.37/]...Done
    Retrieving checksum list [http://salix.enialis.net/i486/13.37/]...Cached
    Retrieving checksum signature [http://salix.enialis.net/i486/13.37/]...Cached
    Verifying checksum signature [http://salix.enialis.net/i486/13.37/]...No key for verification
    Retrieving ChangeLog.txt [http://salix.enialis.net/i486/13.37/]...Cached
    Reading Package Lists...Done
    macondo[~]$ sudo slapt-get --upgrade
    Reading Package Lists...Done
    0 upgraded, 0 reinstalled, 0 newly installed, 0 to remove, 0 not upgraded.

    Done
    macondo[~]$
Last edited by macondo on 29. Jun 2012, 14:43, edited 1 time in total.
User avatar
gapan
Salix Wizard
Posts: 6349
Joined: 6. Jun 2009, 17:40

Re: Can'tedit anything-Sudoers file?

Post by gapan »

macondo wrote:Now you're ROOT and can edit the /etc/sudoers file:

Code: Select all

# nano /etc/sudoers
edit, adding the line you want to the file.
save/exit
Don't ever ever do that. The sudoers file should only be edited using the visudo command.
Image
Image
macondo
Posts: 90
Joined: 16. Jun 2011, 02:08

Re: Can'tedit anything-Sudoers file?

Post by macondo »

gapan wrote: Don't ever ever do that. The sudoers file should only be edited using the visudo command.
Noted.
Explain this to me please? Is there a difference between vi/vim and nano? Or maybe there is another reason dealing with security? I'm curious.
User avatar
gapan
Salix Wizard
Posts: 6349
Joined: 6. Jun 2009, 17:40

Re: Can'tedit anything-Sudoers file?

Post by gapan »

Nothing to do with nano vs vim.

Code: Select all

man visudo
Image
Image
macondo
Posts: 90
Joined: 16. Jun 2011, 02:08

Re: Can'tedit anything-Sudoers file?

Post by macondo »

gapan: i went to the polishlinux link and got this:

Code: Select all

Instead, use the visudo command:

# visudo

This protects from conflicts (when two admins edit this file at the same time) and guarantees that the right syntax is used (the permission bits are correct).
macondo
Posts: 90
Joined: 16. Jun 2011, 02:08

Re: Can'tedit anything-Sudoers file?

Post by macondo »

I did man visudo, i gotcha!
OK, because nano is my export editor in my .bashrc, when i visudo as root, the editor is nano (i hate vim).
Thanks gapan, another thing learned today :)
User avatar
Tim CowChip
Posts: 304
Joined: 27. May 2011, 03:35
Location: Cascade Locks, OR

Re: Can'tedit anything-Sudoers file?

Post by Tim CowChip »

Just remember press the "Ins" key to edit then "Esc" to

Code: Select all

:w
"write"

and

Code: Select all

:q
"quit"

and vi can be as easy as nano.
ImageImage
Post Reply