LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2014, 11:41 PM   #1
ChiggyDada
LQ Newbie
 
Registered: Apr 2012
Distribution: Mint, CentOS, Unbuntu based
Posts: 24

Rep: Reputation: Disabled
sudo: /etc/sudoers is owned by uid 1000, should be 0


Hi.

I'm trying to command-line copy my files from my user Documents directory to an external xfs hard drive where I store things.
I keep getting this error
Code:
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
I've tried doing it as root (hence the error) and via a gui file browser, after trying to change permissions (chown -R) on both my directory and the folder I'm trying to copy on the xfs external drive- both fail, and the "cp -a" command and "sudo cp -a" also fail and kicks up the above error. I'm in linuxmint petra.
What am I doing wrong?

(
 
Old 04-26-2014, 12:17 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
What command are you using to copy the files that gives you this error? Was it something like this?
Code:
sudo cp /etc/sudoers /media/blahblahblad
jdk
 
Old 04-26-2014, 12:28 AM   #3
eklavya
Member
 
Registered: Mar 2013
Posts: 619

Rep: Reputation: 136Reputation: 136
Have you edited /etc/sudoers file or /etc/passwd file? You must not edit these files unless you do not know the consequences of your action.

You must have remembered what have you done before getting the error. Revert your changes.
 
Old 04-26-2014, 01:23 AM   #4
ChiggyDada
LQ Newbie
 
Registered: Apr 2012
Distribution: Mint, CentOS, Unbuntu based
Posts: 24

Original Poster
Rep: Reputation: Disabled
No. I've not edited anything- fairly fresh install.

Looking over all the errors, I keep seeing that my home directory and folders apparently does not exist- even if I open a terminal IN the folder, if I use that exact syntax, it still can't find it. (anyone can r/w to the destination). /home is on a separate partition and includes older files from prior installs (since wiped).
I'm using
Code:
username@laptop ~/Documents $ cp -av /folder /media/username/mountedpartition/folder
I get...
Code:
cp: cannot stat ‘./documents’: No such file or directory
(..."stat =huh???")

...I can make folders and copy from the gui to both, and copy via nemo, but not the terminal. What am I missing?
If I sudo in the terminal I get that weird permissions problem- but it can't find the directories I'm specifying, even if I open terminals within those directories and copy/paste the paths. I gotta be missing something easy and big.

Last edited by ChiggyDada; 04-26-2014 at 01:25 AM. Reason: added /home info
 
Old 04-26-2014, 03:05 AM   #5
eklavya
Member
 
Registered: Mar 2013
Posts: 619

Rep: Reputation: 136Reputation: 136
See the file permission of the file /etc/sudoers, it should be
-r--r----- 1 root root /etc/sudoers
It should be 440.

The file permission of /etc/passwd should be 644
both file's owner should be root and group should be root.

In /etc/passwd file root's uid should be 0 and gid should be 0.
 
Old 04-26-2014, 04:05 AM   #6
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
Well, let's start with a request.. Please provide us with the exact command you runned (and from where), don't replace it with "/folder".. that's important because we need to tie it to the error..

The stat error means that it cannot read that file/folder (it doesn't exist, most likely).. Also, case matters.. so "Documents" is not equal to "documents"

The last question is about the sudo error.. You've tried a command starting with sudo, that's for sure... However, for some reason that file has modified permissions.

Try running (exactly like this):
Code:
su - root
It will ask you for the root password (and, by default this will probably be your first account password, in mint.. but I'm not sure).. Then run:
Code:
chmod 440 /etc/sudoer
 
1 members found this post helpful.
Old 04-26-2014, 05:17 AM   #7
ChiggyDada
LQ Newbie
 
Registered: Apr 2012
Distribution: Mint, CentOS, Unbuntu based
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Smokey_justme View Post
Try running (exactly like this):
Code:
su - root
It will ask you for the root password (and, by default this will probably be your first account password, in mint.. but I'm not sure)..
didn't work, instant:
Code:
su - root
Password: 
su: Authentication failure
...my password doesn't work! I tried many times, rebooted even. Works in everyplace but this. I only have one account and it's the administrator.


Quote:
Originally Posted by Smokey_justme View Post
Well, let's start with a request.. Please provide us with the exact command you runned (and from where), don't replace it with "/folder".. that's important because we need to tie it to the error..
I don't have the terminals open anymore... but here's what I remember
Code:
cp -a /home/documents/ /media/newbie/640a-xfs/backup
(from terminal opened via shortcut on the pannel, then via terminals opened from nemo in the folders so I could get the path in case I was making mistakes -but it never made it to any kind of copy operation, just couldn't find the initial folders regardless, so...). I also tried adding my user name after "/home/" =no difference, apparently there's nothing IN my home folder via the command line...?!
so I tried it with "sudo cp -a ..." and with the -ar switch. tried various paths for the source, by browsing via nemo and opening a terminal and copy-pasting JUST the location. When none of that worked, I check in gparted and did it from the dev, IE, "sudo cp -a /dev/sda8/home/newbie/documents ..."
=instant stat errors. {EDIT} I just learned it helps to "~/" or "~/(folder name)" to start from the right spot. BINGO!

If it helps, I can copy via nemo without any issues. I can also sudo apps (terminal, nemo, and so forth).
Hope that is enough of following the directions... memory is fading now. Thank you for the help.

p.s. OK, if I "~/Documents/FOLDER_E" I can find the folder.
Code:
newbie@laptop ~ $ cp -ar ~/Documents/FOLDER_E /media/newbie/640a-xfs/bak/
cp: cannot create directory ‘/media/newbie/640a-xfs/bak/’: Permission denied
newbie@laptop ~ $ sudo cp -ar ~/Documents/FOLDER_E /media/newbie/640a-xfs/bak/
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Can't get in as su -root.

Last edited by ChiggyDada; 04-26-2014 at 05:20 AM.
 
Old 04-26-2014, 05:43 AM   #8
Smokey_justme
Member
 
Registered: Oct 2009
Distribution: Slackware
Posts: 534

Rep: Reputation: 203Reputation: 203Reputation: 203
hehe.. Here's the thing...

In Linux, each user has it's own folder in the /home directory... Also, like I've said, "Documents" is different then "documents"... That's why the first cp failed..

The correct path is "/home/newbie/Documents"... You can use the command
Code:
pwd
to check the full path of the directory you're currently in (just remember that capitalization matter)

LE: "~/" is actually translated to "/home/newbie/"... You can also use the "~newbie/" variant when using another user, for example...

Now, unfortunately I've googled the root situation in Mint (btw, in Linux that's the Administrator account -- the one and only, others just have permissions to imitate him).. It seems that root is disabled and has no password.. But because of your /etc/sudoers problem you cannot get root priviledges..

Basically, your stuck.. So here's what you might want to do (please be aware that I'm typing this from memory -- and some google to be sure it's correct, however it might fail at some point):

1) Restart your computer..
2) On GRUB menu, press e to enter the editor mode
3) Use the arrow keys to navigate until the line that begins with "linux " and press e when on that line
4) Go to the end of the line and add the following:
Code:
 rw init=/bin/bash
5) Press ENTER and b (or something of this sort) to boot the computer with this settings...
6) After the computer booted into a teminal use the following commands:
Code:
chmod 440 /etc/sudoers
chown root:root /etc/sudoers
passwd root
shutdown -r now
The passwd command will ask you for a root password (just in case something like this should happen again)
The last command reboots your computer.. After this you should be able to reuse commands starting with sudo again..

Last edited by Smokey_justme; 04-26-2014 at 05:56 AM.
 
1 members found this post helpful.
Old 04-29-2014, 05:17 PM   #9
ChiggyDada
LQ Newbie
 
Registered: Apr 2012
Distribution: Mint, CentOS, Unbuntu based
Posts: 24

Original Poster
Rep: Reputation: Disabled
Thank you.
I just got this and it sounds like there's some more things I can try on the other machine (my server) which has the same errors (actually ALL my Linuxmint 16 single-user machines have this problem!!!)

1) I rebooted into root shell via single user. This was a challenge until I learned how to display grub on a single-os system
I.E.
a) reboot system, hitting/holding down shift to get a grub screen.
b) Selected recovery mode
c) selected "root - Drop to root shell prompt"
d) Wanted a password- my user account did not work nor did any other passwords I've ever used for this install. I tried a possible old root password from a PRIOR INSTALL (separate / partition that I wiped for the new/fresh install, keeping my old /home and same user name)
e) Finally got a root shell prompt (WOW!)

then I ran
Code:
 passwd root
to change my root password to something sane and current -repeated with no typos so all good =access in a root shell (WHEW!).

Then to make sure I attempted to run
Code:
mount -t proc proc /proc
mount -o remount,rw /
-but already using proc and done, so all good.

so I changed my sudoers stuff via
Code:
chown root:root /etc/sudoers
chmod 440 /etc/sudoers
and just for the heck of it I ran
Code:
ls /home
and got all the users on this rig. Matched, just what I expected.

so I
Code:
sync
and then
Code:
reboot
I ran into issues getting the machine restarted- the iwl3945 (wifi crap) halted the whole rig, as usual -had to escape and enter out and finally hard-kill the rig, but that's another issue....

OK so that's how to do it.
Strange how that happens. I've never had it happen on rigs where I install Mint alongside already established OS's- now I'm going to try it on my server.
*...
 
Old 04-29-2014, 05:19 PM   #10
ChiggyDada
LQ Newbie
 
Registered: Apr 2012
Distribution: Mint, CentOS, Unbuntu based
Posts: 24

Original Poster
Rep: Reputation: Disabled
Oh, and now I can cp to my hearts content as well as rsync, especially with the correct paths.
Code:
lol
-oh. I just checked and ALL my distros that use sudo and have NOT had a root password set, have needed this fix.

Hopefully that solves everything.
THANK YOU ALL!

Last edited by ChiggyDada; 04-30-2014 at 12:30 AM. Reason: adding that this worked on other systems too
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo: effective uid is not 0, is sudo installed setuid root? awladnas Linux - Newbie 10 08-30-2014 06:03 PM
Can you let this Set-UID program (owned by root) run?? goldengriff Ubuntu 5 11-20-2013 07:54 PM
[SOLVED] whoami: unknown uid 1000 Lobinho Linux - Embedded & Single-board computer 2 01-31-2013 04:25 AM
sudoers file error: owned by gid 10, should be 0 usafitz Linux - Newbie 8 12-01-2007 05:08 PM
uid, gid don't exist, yet files owned by them, i need to delete them mattie_linux Linux - General 10 05-05-2005 03:57 AM


All times are GMT -5. The time now is 01:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration