Link to home
Create AccountLog in
Avatar of A A
A A

asked on

Receive error when trying to change to root

Hi experts

kindly be informed that I receive this error when try to do sudo su

sudo:unable to stat/etc/sudowers :permission denied

sudo: no valid sudoers sources found ,quitting

sudo: unable to unitialize policy plugin 
Avatar of serialband
serialband
Flag of Ukraine image

Did you delete the /etc/sudoers file?  Did you change the permissions on /etc/sudoers?
Also sudo su is a dumb way to become root, unless you have some really ancient version of sudo.

man sudo
...
       -i, --login Run the shell specified by the target user's password database
                   entry as a login shell.  This means that login-specific
                   resource files such as .profile, .bash_profile or .login will
                   be read by the shell.  If a command is specified, it is passed
                   to the shell for execution via the shell's -c option.  If no
                   command is specified, an interactive shell is executed.  sudo
                   attempts to change to that user's home directory before
                   running the shell.  The command is run with an environment
                   similar to the one a user would receive at log in.  Note that
                   most shells behave differently when a command is specified as
                   compared to an interactive session; consult the shell's manual
                   for details.  The Command environment section in the
                   sudoers(5) manual documents how the -i option affects the
                   environment in which a command is run when the sudoers policy
                   is in use.
...

Open in new window

Avatar of noci
noci

sudo -s  can be useful as well (prevent ovewriting symbols from .bashrc).
sudo -s also allows accessing accounts without valid login environment like www-data etc.

Avatar of A A

ASKER

I dont know exactly what my last colleague did but how to recover that  as usual  if it is physically accessible or volume  can be mounted to another aws machine   known that, I dont have physical access to machine as it is in the AWS cloud.  
Do you have the actual root password so you can run su?  Is there another account that you can log into that can run sudo? Is there an ssh key in the root account?  Do you have access to AWS to boot the VM into single user or some other mode that can let you recover the VM?
Avatar of A A

ASKER

 all accounts are configured to get to root by running sudo su  as I dont write root  password 
You only answered my first question.  What about the rest?
Avatar of A A

ASKER

No I dont have root password all other accounts have same error  I can detach volume and attach it to another machine
ASKER CERTIFIED SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account