ubuntu sudo does not need to enter a password

For non-server users, just use an ordinary Ubuntu desktop users, too troublesome password so you can set it. . . . . . . . .

Sudo to set a password is not required

to edit / etc / sudoers file added to the user, the file can only be used VI sudo command

1) is first need to switch to the root, su - (attention - which su are different and, in use the command "su" when just switch to root, but the root environment variable is not passed in the past, or the current environment variables used almost with "su -" command environment variables together with the past, and just like root login )

2) then the gedit / etc / the sudoers,

the root ALL = (ALL) ALL

your_user_name ALL = (ALL) ALL

and then press the Esc, then type: w save the file before and: q

so that they join put sudo group, may be used sudo commands.

3) default after 5 minutes just entered sodo password expires, the next need to re-enter the sudo password, if you feel trouble in sudo password when the previous input can be replaced by the following:
your_user_name ALL = (ALL) NOPASSWD: ALL

4) If you want to set only certain commands sudo, then, your_user_name ALL = (root) NOPASSWD : / sbin / mount, (root) NOPASSWD: / bin / umount, (root) NOPASSWD: / mnt / mount, (root) NOPASSWD: / bin / rm, ( root) NOPASSWD: / usr / bin / make, (root) NOPASSWD: / bin / ln, (root) NOPASSWD: / bin / sh, (root) NOPASSWD: / bin / mv, ( root) NOPASSWD: / bin / chown , (root) NOPASSWD: / bin / chgrp, (root) NOPASSWD: / bin / cp, (root) NOPASSWD: / bin / chmod

Note: sometimes you will set up user nopasswd , but does not work, because the group is disposed behind the cover, the group need to be provided nopasswd. // this is the key, there have been many times, finally became known.

ALL = Joe (ALL) the NOPASSWD: ALL
% ADMIN ALL = (ALL) the NOPASSWD: ALL

two su set to not require a password
if the password is not necessary to require a user su command, it is necessary to modify the following:
1) to switch to root authority;
2) create a group for the wheel, Wheel command groupadd;
3) the user joins wheel group, the command -G Wheel joe the usermod;
4) modify su profile /etc/pam.d/su, add the following items :
 Group = Wheel pam_wheel.so required auth
# Uncomment the this IF you want to BE Wheel Members of Able to
# A su the without password.
 auth Sufficient pam_wheel.so Trust use_uid
At this point you can use the following command, for example, and does not require a password: su joe - c command.
Three ubuntu enable root

sudo -i
sudo passwd root
disable by below:
sudo passwd root -dl

Guess you like

Origin www.cnblogs.com/longchang/p/11959333.html