How to disable the su to root in Linux using PAM.

Posted: September 2, 2015. At: 11:07 AM. This was 2 years ago. Post ID: 8342
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

The default Linux behavior allows the user to gain root access by typing su and entering the root password to gain a root prompt. If you wish to disable this behavior, then run this command: vim.tiny /etc/pam.d/su then uncomment this line:

#auth required use_uid

This will require a user to login as root at a terminal to be able to use a root prompt. They will no longer be able to use su to login as root. This is the default configuration in FreeBSD. And might be useful to anyone who wants to prevent users accessing root via su.

No comments have been made. Use this form to start the conversation :)

Leave a Reply