LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot get root to work (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-get-root-to-work-4175532650/)

kmcleod 01-31-2015 08:34 PM

Cannot get root to work
 
I have been getting permission denied issues when trying to log into as root. I have set my password and when I type su - root and enter in my password I keep getting either password incorrect when I know I am typing it in correctly or acess permission denied from su. Can anyone explain what I am doing wrong. I am trying to get into /etc/passwd for homework assignment and I get permission denied when logged in as my user. Any help will be great. I have in the past been able to logg in to root but now I cant seem to get into it. This is a new install of ubuntu 14

frankbell 01-31-2015 08:44 PM

What distro are you using? Some distros--Ubuntu and its derivatives, in particular--disable the root login by default and want you to use the sudo command.

kmcleod 01-31-2015 08:54 PM

Cannot get root to work
 
Frank I am using Ubuntu desktop newest verion of 14. I am admin on my computer and I set the root unix/linux password and then typed it in correctly but still keep getting invaild password or no permission for su command

Kevin

frankbell 01-31-2015 09:03 PM

In that case, I have no idea what the problem might be (it might have been nice to include the additional detail in your original post so I wouldn't have wasted your time).

Has the password previously worked?

If it were me, I'd test like this: sudo su to root, then reset the password to something simple for testing purposes. If su then worked, I'd reset the password back to something complex and test again.

kmcleod 01-31-2015 09:10 PM

Frank

First I want to thank you for taking your time to answer my questions and apologie for not including this first. When I setup root I tried it and it did work so I am stumped as to why it,s not working. Thank you for attempting to answer my question.

K

frankbell 01-31-2015 09:37 PM

No worries. This is truly puzzling; I certainly want to know how it turns out.

Passwords are hashed in /etc/shadow, but you might try catting it and /etc/passwd to see whether the files look okay.

Are you still able to sudo? If so, I'd be inclined to recommend resetting the root password for testing purposes, but I'll admit I've not had to deal with this particular problem first-hand.

kmcleod 01-31-2015 09:53 PM

Yeah I am not able to get into /etc/passwd/ or /etc/shadow/ as I get the you do not have permission. Sudo does not work for me either. I will post her if I figure out what is going on. If I need to I will reset the password for root again and create a new password. I reused the same password the last time this evening when resetting root password, so this might be part of the issue but again I am slowly typing in the password and still get invalid password. I have done this several times where it goes 3 attempts have been made and su - root command then no longer works and sudo no longer works. I then close out the terminal and try again with a new terminal. This could be part of the issue.

K

rknichols 01-31-2015 10:02 PM

/etc/passwd should be world-readable. It's just /etc/shadow that needs to be restricted. If you can't get to /etc/passwd, then post what you get from
Code:

ls -ldn / /etc /etc/passwd

kmcleod 01-31-2015 10:10 PM

Thanks this worked but again from earleir post I have to get into /etc/shadow/ for user and group permission for a homework assignment and to do this I have to be in root. I'm almost tempted to wipe this computer and atart all over again. Before I do this I will create a ubuntu desktop in virtualbox and see if I can get it to work there.

K

btmiller 01-31-2015 10:21 PM

Note that there's no trailing slash - the files are /etc/passwd and /etc/shadow (because they're files, not directories).

What do the following command show?

Code:

sudo getent passwd root
sudo getent shadow root

After you try to login you might also look at /var/log/auth.log to see if there are any log messages that might indicate why authentication failed.

kmcleod 01-31-2015 10:36 PM

sudo getent passwd root makes the ask for password and when I trie to enter the password I get invalid password each time. When I try the /var/log/auth.log I get permission denied.

Completly confused with this. LOading a ubuntu desktop on VB and going to see if I get the same issues. If I don't I am just going to wipe the laptop and start again all over. I don't have any files saved on this machine and all of my othe distros needed are on another laptop as VB machines.

K

frankbell 01-31-2015 10:50 PM

Quote:

sudo getent passwd root makes the ask for password and when I trie to enter the password I get invalid password each time
What happens when you

Code:

getent passwd root
as user?

I just entered that as user on Slackware and got this:

Code:

~/ $ getent passwd root
root:x:0:0::/root:/bin/bash

Afterthought:

If sudo doesn't work any more and you have no valuable files in this install, I'm inclined to think that reinstalling is going to end up the best option. Sometimes you have to stop fishing and cut bait, but it would be nice to know what went wrong.

kmcleod 01-31-2015 11:10 PM

To All that have offered help I now have root working. I created a new password for root and type sudo su - and I get into root but without haveing to type in the root passwd so I'm confused by that but at least I can do my homework and because messing with the shadow files can be a bad idea. I think I will work on this with my VB machine of ubuntu.

K

descendant_command 01-31-2015 11:17 PM

Quote:

Originally Posted by frankbell (Post 5309865)
but it would be nice to know what went wrong.

User error.

frankbell 01-31-2015 11:23 PM

Glad you got it fixed and thanks for the update!

As an aside, I think a post containing only the words "user error" is a bit harsh; it does not contribute to answering a Linux Question.

We all make user errors; that's why there is a CTRL-Z.

Making mistakes is how we learn. I congratulate OP for being dogged enough to fix this and learn from it.


All times are GMT -5. The time now is 04:05 PM.