Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to realize password-free setting of su and sudo in linux

Shulou Source: shulou.com Published: 2022-06-01 01:03:39 10月03日 Update

This article mainly introduces how to achieve su and sudo password-free settings in linux, which is very detailed and has a certain reference value. Interested friends must read it!

It is troublesome to enter the password when sudo. Just replace the input with the following:

Your_user_name ALL= (ALL) NOPASSWD: ALL

Note: sometimes you set the user nopasswd, but it doesn't work because it is overridden by the later group setting.

You need to change the setting of group to nopasswd as well.

Your_user_name ALL= (ALL) NOPASSWD: ALL

% admin ALL= (ALL) NOPASSWD: ALL

Set su to not require a password

If you do not need to enter a password for a user's su command, you need to change the following:

Switch to root permission

Create group as wheel and command as groupadd wheel

Add the user to wheel group with the command usermod-G wheel your_user_name

Modify the configuration file / etc/pam.d/su of su by adding the following:

Auth required pam_wheel.so group=wheel # Uncomment this if you want wheel members to be able to# su without a password.auth sufficient pam_wheel.so trust use_uid

At this point you can use the su root command without entering a password.

These are all the contents of this article entitled "how to achieve password-free settings for su and sudo in linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Password command input content user time article value function interest reason guy partner file more permissions knowledge so far industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker MySQL OPPO Reno Redmi