This commit is contained in:
wenyongda 2025-03-14 13:50:28 +08:00
parent 3cffc9f38d
commit 09b16bebff
2 changed files with 33 additions and 0 deletions

View File

@ -410,6 +410,36 @@ Linux 下文件有三种权限 r 读 w写 x可执行
chmod 755 file chmod 755 file
``` ```
### 开启sudo权限
```shell
#添加sudo文件的写权限,命令是:
chmod u+w /etc/sudoers
#编辑sudoers文件
vim /etc/sudoers
#找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)
```
> ps:这里说下你可以sudoers添加下面四行中任意一条
>
> ```
> youuser ALL=(ALL) ALL
> %youuser ALL=(ALL) ALL
> youuser ALL=(ALL) NOPASSWD: ALL
> %youuser ALL=(ALL) NOPASSWD: ALL
> ```
> 第一行:允许用户youuser执行sudo命令(需要输入密码).
> 第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
> 第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
> 第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.
```shell
#撤销sudoers文件写权限,命令:
chmod u-w /etc/sudoers
```
这样普通用户就可以使用sudo了.
## Shell 脚本 ## Shell 脚本
### 为什么大多数 shell 脚本都包含 #! /bin/bash 在 shell 脚本的开头? ### 为什么大多数 shell 脚本都包含 #! /bin/bash 在 shell 脚本的开头?

View File

@ -3,3 +3,6 @@ title: Python
date: 2025-03-10 14:26:30 date: 2025-03-10 14:26:30
tags: tags:
--- ---
# Python