how do I access the root account on my 7.10 server

Asked by Bob Pearson

In order to set up my server I need to access the root account. Following the initial installation DNS, LAMP, OpenSSH I logged in with my username and password OK, then entered the code:
sudo passwd root
then I tried to give 'root' a password, but I just get "sorry, try again". Can someone help please

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Bob Pearson
Solved:
Last query:
Last reply:
Revision history for this message
Sébastien Corriveau (sebcor-deactivatedaccount) said :
#1

You can access the root account by typing: sudo su -

Hope that helps.

Revision history for this message
Bob Pearson (admin-bpcsbromyard) said :
#2

Hi Sebastien

I've tried that but it doesn't work. If I enter:
sudo su -
it still asks for a password and then when I try to enter try to enter a
password I still get:
Sorry, try again.
If I enter my my normal non administrative password then I get:
[username] is not in the sudoers file.
If I try su -
then I am asked for a password and whatever I type in I just get:
Authentication failure

hope you can give me a further clue

Bob Pearson

Sébastien Corriveau wrote:
> Your question #17984 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/17984
>
> Status: Open => Answered
>
> Sébastien Corriveau proposed the following answer:
> You can access the root account by typing: sudo su -
>
> Hope that helps.
>
>

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#3

Try:

sudo -i

Please give your user password.

Hope This Help

Revision history for this message
Sébastien Corriveau (sebcor-deactivatedaccount) said :
#4

> it still asks for a password

Yes, the "sudo" command usually ask you for a password, but it is yours. So you don't need to set a password for root and nobody should be able to log in directly as root. This is good security policy.

> [username] is not in the sudoers file.

Your userid is not allowed to execute a privileged command.

The sudoers file (/etc/sudoers) specifies who is allowed to execute such command. The default sudoers file on my system (Gutsy) contains the following line:

    %admin ALL=(ALL) ALL

It means that all members of the "admin" group are allowed to execute any command using sudo. Your userid is probably not a member of that group. Except for the initial userid (the one created during the installation process), a new userid does not have those privileges by default.

If you want to add administrative privileges to a userid, you have to run the following command using an admin account:

    sudo adduser {username} admin

Or, you can use the GUI interface by selecting: System -> Administration -> Users and Groups

Hope that helps.

Revision history for this message
Bob Pearson (admin-bpcsbromyard) said :
#5

I am providing the following additional information:
I am the only user and I have only got the one username and password which is the one used at the time of the installation. I login using this, no problem. Then I try to follow the instructions in the tutorial at the following link:
http://www.howtoforge.com/perfect_server_ubuntu7.10_p3
but this does not work.

Revision history for this message
Bob Pearson (admin-bpcsbromyard) said :
#6

Hi marcobra

That doesn't work I'm afraid.

I am the only user and I have only got the one username and password
which is the one used at the time of the installation. I login using
this, no problem. Then I try to follow the instructions in the tutorial
at the following link:
http://www.howtoforge.com/perfect_server_ubuntu7.10_p3
but this does not work. Is there another way to run the setup suggested
in this tutorial without becoming root?

best regards

Bob

marcobra wrote:
> Your question #17984 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/17984
>
> Status: Open => Answered
>
> marcobra proposed the following answer:
> Try:
>
> sudo -i
>
> Please give your user password.
>
> Hope This Help
>
>

Revision history for this message
Bob Pearson (admin-bpcsbromyard) said :
#7

Hi Sebastien

I am the only user and I have only got the one username and password
which is the one used at the time of the installation. I login using
this, no problem. Then I try to follow the instructions in the tutorial
at the following link:
http://www.howtoforge.com/perfect_server_ubuntu7.10_p3
but this does not work. Is there another way to run the setup suggested
in this tutorial without becoming root?

best regards

Bob

Sébastien Corriveau wrote:
> Your question #17984 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/17984
>
> Sébastien Corriveau proposed the following answer:
>
>> it still asks for a password
>>
>
> Yes, the "sudo" command usually ask you for a password, but it is yours.
> So you don't need to set a password for root and nobody should be able
> to log in directly as root. This is good security policy.
>
>
>> [username] is not in the sudoers file.
>>
>
> Your userid is not allowed to execute a privileged command.
>
> The sudoers file (/etc/sudoers) specifies who is allowed to execute such
> command. The default sudoers file on my system (Gutsy) contains the
> following line:
>
> %admin ALL=(ALL) ALL
>
> It means that all members of the "admin" group are allowed to execute
> any command using sudo. Your userid is probably not a member of that
> group. Except for the initial userid (the one created during the
> installation process), a new userid does not have those privileges by
> default.
>
> If you want to add administrative privileges to a userid, you have to
> run the following command using an admin account:
>
> sudo adduser {username} admin
>
> Or, you can use the GUI interface by selecting: System -> Administration
> -> Users and Groups
>
> Hope that helps.
>
>

Revision history for this message
Jim Qode (jimqode) said :
#8

If this is the first user you created at the installation you should be able to do 'sudo su'. If you are REALLY sure you are using the first account and still can't do sudo su, then file a bug.

Revision history for this message
Bob Pearson (admin-bpcsbromyard) said :
#9

The problem seems to be to do with the additional software, i.e. DNS, LAMP and Mail. I did a clean install on a fresh hard drive, but the problem repeated, i.e. couldn't run sudo su or any other sudo command. I then did another install with just the OpenSSH server, without DNS LAMP and Mail, then it works fine.

Revision history for this message
Paul Barron (paul-barron) said :
#10

I have been having the same problem with Gusty Server.
I installed LAMP, MAIL, OPENSSH, PostgreSQL
I login when the login prompt appears with the username and password I entered during install.
On trying sudo apt-get update. I am asked for the password for [username}
on entering the password I created during install get
[username] is not in the sudoers file
I tried reinstalling just to make sure I had not been rushing through the install and missed something about the root account.
The new install has the same options as above. Then tried sudo apt-get update
same again.
Tried the install again with OpenSSH server, without DNS LAMP and Mail as Bob tried.
On logging in for the first time I get the message
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details. ( I had not seen this on the other two installs)
On entering sudo apt-get update, I am asked for my password, on entering that, the system executes the command.
Great I can now get on testing the RAID system, Thanks Bob.

Revision history for this message
zahir76 (zahir-ahmad) said :
#11

I faced the same problem but I installed Gutsy server without DNS, LAMP etc. except for OpenSSH and it worked fine, used Putty to login to the server and used root privileges to shutdown remotly and so on...

And when installed with DNS, LAMP etc... I was not allowed root access. Not in- soduers files.
BUT I had previoulsy installed Gutsy Desktop on that same and ofcourse dual booted the Gutsy server- can this be any issue?

I'd like to have any view on this, Thank you.