jhin 不在 sudoers 文件中。此事将被报告。

本文介绍如何将普通用户添加到sudoers文件中,使该用户能够以root权限执行命令,包括切换到root用户、编辑sudoers文件及添加用户到sudoers等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 切到 root 用户

su root

2. 编辑 sudoers 文件

vim /etc/sudoers

3. 将 jhin 加入到 sudoers 中

## Allow root to run any commands anywhere 
root    ALL=(ALL)   ALL
jhin    ALL=(ALL)   ALL

4. 强制保存并退出

:x!

参考:
http://blog.youkuaiyun.com/wenxuechaozhe/article/details/69092769

P.S.
部分文件翻译 (欢迎补充翻译)

## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
## Sudoers 允许特定用户像 root 用户一样运行各种命令,而不需要 root 用户的密码。
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
## 在文件的底部提供了相关命令集合的示例,然后可以将其委托给特定的用户或组。 
## 
## This file must be edited with the 'visudo' command.
## 这个文件只能通过 visudo 命名进行编辑

## Host Aliases
## Groups of machines. You may prefer to use hostnames (perhaps using 
## wildcards for entire domains) or IP addresses instead.
# Host_Alias     FILESERVERS = fs1, fs2
# Host_Alias     MAILSERVERS = smtp, smtp2
## 主机别名
## 机器组,你或许更喜欢使用主机名(可能使用通配符整个域) 或者 IP 地址代替

## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname 
## rather than USERALIAS
# User_Alias ADMINS = jsmith, mikem
## 用户别名
## 这个通常不是必须的,因为你可以使用常规组
## (ie, 文件, 轻量目录访问协议, NIS 目录访问技术, 等等) 在这个文件中 - 仅用 %groupname 

## Command Aliases
## These are groups of related commands...
## 命令别名
## 这些都是组相关的命令
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值