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 What am I doing wrong? ( |
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 |
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. |
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 Code:
cp: cannot stat ‘./documents’: No such file or directory ...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. |
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. |
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 Code:
chmod 440 /etc/sudoer |
Quote:
Code:
su - root Quote:
Code:
cp -a /home/documents/ /media/newbie/640a-xfs/backup 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/ |
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 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 6) After the computer booted into a teminal use the following commands: Code:
chmod 440 /etc/sudoers The last command reboots your computer.. After this you should be able to reuse commands starting with sudo again.. |
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 Then to make sure I attempted to run Code:
mount -t proc proc /proc so I changed my sudoers stuff via Code:
chown root:root /etc/sudoers Code:
ls /home so I Code:
sync Code:
reboot 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. *... |
Oh, and now I can cp to my hearts content as well as rsync, especially with the correct paths.
Code:
lol Hopefully that solves everything. THANK YOU ALL! :D |
A better fix for this issue on Mint 19
This worked for me
Code:
sudo passwd root however i still get this warning: /etc/sudoers.d is owned by uid 1000, but should be 0 when trying to run this: Code:
sudo chmod 440 /etc/sudoers.d Code:
su - root |
all i had to do was...
this thread was a lifesaver. just wanted to share what worked for me.
drop to root shell from recovery mode Code:
chown root:root /etc/sudoers rebooted, got some weird graphics mode, rebooted, voila. all was trying to do is figure out why I can't add visudo to the exemptions list in sudoers. i'm assuming that's because visudo edits files that still require sudo/root permissions...giving up on that. (ubuntu 18.04) |
visudo edits the /etc/sudoers file which does not even have write permissions. (440).
It cannot be exempted because it MUST have a root user running it before it will operate. The program itself checks the UID of the user running it and will not launch if it is not a root user (or a user running as root using sudo). Arbitrarily changing permissions and changing away from the default config in the sudoers file without a deep and thorough understanding of what you are doing can lead to a totally fubar setup. Many times new installs are prompted by just a simple typo or a change without considering the consequences. |
Quote:
I also object to "arbitrarily." I was experimenting on my machine, not just changing things willy-nilly 'cuz I thought my /etc files needed some sprucing up and I was just tossing write permissions around left and right, arbitrarily... (FWIW: I'd removed the write permission before I tried to chown root:root /etc/sudoers so I didn't need to do that in the recovery root shell.) *E.g., if you'd sent me a personal email on Monday before making this mistake, or even thinking about making this mistake, then that would have been great! |
Quote:
Evo2. |
All times are GMT -5. The time now is 07:55 PM. |