1

I am told that the most basic security to set up in Linux is to change the superuser name from root to something obscure

so I run these steps to add new user

$ /usr/sbin/adduser new_username
$ passwd new_usersname

then went to give ssh access to new user

$ /usr/sbin/visudo
root           ALL=(ALL)        ALL  // didn't modify this
new_username   ALL=(ALL)        ALL  //added this

Now despite the above change, my new user new_username does not have superuser privileges. I am always forced to change to root using su use root privileges.

So, what I want is to remove completely the root account, and give all root's power to my new_user

How do I accomplish this task ?

  • 1
    Removing the root user is impossible (for a ton of good reasons). That is not what you want to do; you want to give your user permanent root permissions. But, you shouldn't do that either. You should learn how to use sudo safely and effectively. – HalosGhost Jul 24 '14 at 12:11
  • You write about giving ssh access, but you configure sudo... Did you check, wheather sudo works or not? (superuser.com/questions/553932/…) – Tobias Jul 24 '14 at 12:20
  • There is already a question about changing root's name, but that is a weird thing to do. If you want security it would make more sense to prevent directly login as superuser, and do everything through sudo. – Leiaz Jul 24 '14 at 12:21
  • 1
    You talk about renaming root, but your information shows you trying to add another sudo user, and your comments talk about using su not sudo. This all makes no sense. Then as mentioned, removing 'root' is a very bad idea. Where are you getting this info? – Patrick Jul 24 '14 at 12:40
  • 2
    "I am told that the most basic security to set up in Linux is to change the superuser name from root to something obscure" This is garbage. G A R B A G E. Whoever told you that, don't listen to them again. It will be drop dead easy to get the new username anyway, it's the user with UID 0. And if it ain't uid 0, it's whoever owns all the system files. And if that ain't the superuser, you have just introduced a big security hole, not to mention broken things that may require it. Forget about this now. – goldilocks Jul 24 '14 at 13:20
1

Your new user new_username will not have root privileges after editing the sudoers file. This change only allows new_username to run sudo in order to run a task with superuser privileges:

$touch testfile
$chown new_username testfile
chown: changing ownership of 'testfile': Operation not permitted
$sudo chown new_username testfile
[sudo] password for new_username:
$

There are various debates about renaming the root account. It would probably be better to make it secure instead of renaming it.

0

You can always disable a root account by setting his login prompt to nologin in /etc/passwd file. However, after setting this, you would not be able to use root account even using ssh or su.

root:x:0:0:root:/root:/sbin/nologin

Now, as per this link, after setting sudo privileges to an user, the user must log off and log in back again for the effects to take place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.