Заметки сисадмина » How to disable sudo and su on Ubuntu?

Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

How to disable sudo and su on Ubuntu?

2023-11-14 · Posted in Ubuntu

You don’t have to disable sudo to get a root shell. Run:

And now every command you type is as the root user.

Also when you are logged in as root, you don’t have to preprend every command with sudo anymore. If think, you are confused here. You sudo before a command when you run it as a user, but once root, you dont need it.

It is obvious you should be extra carefull when you do that. Use a colored prompt (red, enabled by default) to always know when you are in a root shell.

Also, it could be a good idea to set an timeout on your root session by using the TMOUT environment variable

In /root/.bashrc, add the line

for a 5 minutes timeout.

Leave a Reply