Jump to content

Disabling root account (Ubuntu 14.04)


sKunKbad

Recommended Posts

I've been doing a lot of studying of Linux lately. I enabled the root acount to do some work. When done, even if I logout, close the terminal, or reboot, I can still access the root account without supplying the root password. So what am I not understanding or what am I doing wrong? I don't really need to disable the root account, but this is just a learning experience, and I'm not understanding why I still have access. See below:

 

 

# I needed to enable root access for something

skunkbad:~$ sudo passwd root

 

# I did what I needed to do

skunkbad:~$ sudo -i

root@ubuntu-Inspiron-3647:~#

 

# I logout from root

root@ubuntu-Inspiron-3647:~# logout

 

# I disable the root access per instructions from many internet references

skunkbad:~$ sudo passwd -dl root

 

# Root access is still available, even if I close and reopen the terminal

skunkbad:~$ sudo -i

 

# I logout from root

root@ubuntu-Inspiron-3647:~# logout

 

# Trying to access root via su prompts for password, and old password is wrong

skunkbad:~$ su

Password:

su: Authentication failure

Link to comment
Share on other sites

 

When done, even if I logout, close the terminal, or reboot, I can still access the root account without supplying the root password.

 

The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell in that case sudo it will read the skunkbad's password. If you create another regular user account, for instance jazzman:password and grant it as root using the sudoers security policy, sudo will read his password when you're logged in to his current shell. As for the last question, running a su command, it seems that your "skunkbad" account is not permitted to use it. Su and Sudo are not the same.

Edited by jazzman1
  • Like 1
Link to comment
Share on other sites

The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell in that case sudo it will read the skunkbad's password. If you create another regular user account, for instance jazzman:password and grant it as root using the sudoers security policy, sudo will read his password when you're logged in to his current shell. As for the last question, running a su command, it seems that your "skunkbad" account is not permitted to use it. Su and Sudo are not the same.

 

Thanks for your response. It's odd to me that su and sudo -i would be different, and you are correct. I think that the differences are the PATH and some environment variables, according to this:

https://help.ubuntu.com/community/RootSudo#Special_notes_on_sudo_and_shells

 

When I specify a new password for root, I am able to use su.

 

Is there a difference between "sudo su" and just "su"?

Link to comment
Share on other sites

Hey sKunKbad, what I read this morning at Ubuntu documentation, that the root account password in Ubuntu is locked by default. I didn't know that, I am with RedHat based distros.

 

 

Is there a difference between "sudo su" and just "su"?

 

No. In both cases you will find yourself into the user's shell with root environment. I think, the alias of sudo su is just sudo -s.

Link to comment
Share on other sites

jazzman1, there sure is a lot to learn. I've started reading the LPI Linux essentials exam preparation, thinking that I would just breeze through it, but that's certainly not the case:

 

https://shop-download.linupfront.de/cc/lxes-en-manual-cc.pdf

 

I've only worked on Ubuntu Desktop, Ubuntu Server, and CentOS Server. Right now I'm working as a web dev and design freelancer, and I stay busy, pay the bills, etc. I wouldn't say it's boring, but I'd like to be in a position to do something else. I was thinking to self-teach myself Linux system administration, but wow is there so much to learn.

 

Are you self taught, or study at a school?

Link to comment
Share on other sites

I learned programming and Unix systems many years ago purely out of my personal interest and have absolutely no formal education on them. If you want to teach yourself in linux system administration area. I'd advise to start learning on redhat servers and lately getting some redhat certificate. The previous programming experience will help a lot.  

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.