Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

How to get / gain root shell without root password

Date: 2011-02-16 00:00:00 -0400

Introduction

Since the appearance of Ubuntu, sudo became more famous than ever, I do not use Ubuntu but certainly use sudo since my first meet with Ubuntu.

But, if you need to issue more than just one simple command in the shell, you’d better switch to root work there and then go back to your account.

This can be done with

su -

And then entering the root password, but what if you are using Ubuntu, where you can not switch to root account, or what your users can do if you do not want to give all of them the root password, and only give the permissions in the sudoers file.

How to get root shell without the root password

If you are in the sudoers file, and your account have enough permissions, you will be able to get a root shell with:

sudo -s

This will give you the shell you have in the SHELL environment variable, or if not set, the shell configured in the /etc/passwd file.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.