I am a new user to Ubuntu 10.10
My problem is when I start my machine it takes me to login screen of Ubuntu
but I didn't get option for logging in as user or root
I know my root password and all
even cant make a ssh request
I goggled it I got to know to press Alt+Ctrl+F1it takes me to login of user
in this user after logging I am unable to write sudo commands
After searching for a while I came to know that permission to sudo might be crating a problem
permission to a sudo must be 440 I think which is 777 now
How to start up with my root access
4 Answers
First of all if you haven't touched sudo or changed anything on /etc then its just your fear and you should read what Sergey has to say. Apart from that check if the file permission part is correct. Just do ls -l /etc | grep sudoers and see if the output is somthing like this:
-r--r----- 1 root root 574 2011-03-25 20:34 sudoerswhere -r--r----- part shows your permission to be 440 anything other than that should be changed to that as far as I know. If you can login as root on rescue mode, you can easily change file permission with chmod 440 /etc/sudoers command. If you are not allowed sudo command at all you may need an external live-usb to recover. Content of /etc/sudoers or visudo should look like this[atleast in my case]:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
#includedir /etc/sudoers.d 2 In Ubuntu, you generally never log in as root directly - especially you do not start an X session as root. Also, by default root password is not set/unknown so you can't log in directly as root.
The initial user created during Ubuntu installation has an ability to "sudo" - i.e.
sudo apt-get updatesudo then asks you for YOUR password, not root password.
In a terminal session, if you want to execute many commands as root (or maybe even start some graphical programs as root), you type
sudo suand again enter YOUR password. This will start a root terminal session.
The "original" Ubuntu user can make other users "admins" so they can execute commands as root too.
Does it solve your problem?
3I don't know how your sudo permission got messed up. This is what my permissions are for sudo and ls:
-rwsr-xr-x 1 root root 168800 2011-04-15 21:32 /usr/bin/sudo
-rwxr-xr-x 1 root root 105776 2011-02-23 19:54 /bin/lsThe key thing here is to have the setuid bit - which allows an application to change the user id: Which might have been disabled.
If you need to restore sudo, you can boot Ubuntu into "recovery mode", where it should give you the ability to open up a root shell.
If you feel that your permissions might be messed up, I think running dpkg-reconfigure sudo while in recovery mode can help.
After that, you can run visudo to open up the sudoers file and edit it to add your user.
Assuming you've read the manual on sudo by typing in a prompt 'man sudo' and it really is broken the easiest way for a new user to fix almost anything is the reinstall. If you don't have the time or you have a lot installed already I recommend not using my answer.