1.sudo 不需要输入密码
打开终端,执行命令:sudo visudo
在sudo那行添加一下NOPASSWD,如下,然后保存就可以了
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALLi) NOPASSWD:ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
2.开机自动执行命令或脚本
在程序中搜索starup applications就可以,然后打开程序,点击add

命令得话,直接输入命令,比如挂在usb等,如果执行脚本就输入脚本名字,如下图。但是脚本要放到根目录下:~/

本文介绍了如何在Linux系统中配置sudo命令无需输入密码,通过编辑sudoers文件添加NOPASSWD指令实现。同时,讲解了如何设置开机自动执行命令或脚本,只需在启动应用程序程序中添加相关命令或脚本路径即可。

2669

被折叠的 条评论
为什么被折叠?



