linux普通用户添加root权限
新增一个普通用户并进入该用户:
[root@VM_0_7_centos ~]# groupadd mall
[root@VM_0_7_centos ~]# useradd mall -m -d /home/mall -g mall -s /bin/bash
[root@VM_0_7_centos ~]# passwd mall
Changing password for user mall.
New password:
BAD PASSWORD: The password is shorter than characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@VM_0_7_centos ~]# su - mall
安装yum-utils失败了,提示需要root权限:
[mall@VM_0_7_centos ~]$ yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: fastestmirror, langpacks
You need to be root to perform this command.
使用sudo获取root权限:
[mall@VM_0_7_centos ~]$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2 We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things: #) Respect the privacy of others.
#) Think before you type.
#) With great power comes great responsibility. [sudo] password for mall:
mall is not in the sudoers file. This incident will be reported.
它说该普通用户没有在sudoers文件里,切换回root:
[mall@VM_0_7_centos ~]$ su - root
Password:
Last login: Wed Oct :: CST from 202.101.145.54 on pts/
Last failed login: Wed Oct :: CST from 110.119.120.10 on ssh:notty
There were failed login attempts since the last successful login.
修改sudoers文件,加入写权限:
[root@VM_0_7_centos ~]# chmod +w /etc/sudoers
[root@VM_0_7_centos ~]# vi /etc/sudoers
新增下面标红的那一行,把普通用户mall加进入:
敲:wq保存后,撤销sudoers文件写权限:
[root@VM_0_7_centos ~]# chmod -w /etc/sudoers
重新进入mall用户,下载yum-utils:
[root@VM_0_7_centos ~]# su - mall
Last login: Wed Oct :: CST on pts/
[mall@VM_0_7_centos ~]$ sudo yum -y install yum-utils device-mapper-persistent-data 1vm2
[sudo] password for mall:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package yum-utils-1.1.-.el7.noarch already installed and latest version
Package device-mapper-persistent-data-0.8.-.el7.x86_64 already installed and latest version
No package 1vm2 available.
Nothing to do
这回可以了,不过其实已经安装过了,白折腾了。
linux普通用户添加root权限的更多相关文章
- Linux给用户添加sudo权限
一.linux给用户添加sudo权限: 有时候,linux下面运行sudo命令,会提示类似: xxxis not in the sudoers file. This incident will be ...
- linux普通用户使用root权限执行命令的脚本
上一篇有说到普通用户使用免密登录并使用root权限: http://www.cnblogs.com/01-single/p/8919254.html 现在使用脚本批量实现部署系统任务操作步骤: #!/ ...
- 给普通用户添加root权限
>>提君博客原创 http://www.cnblogs.com/tijun/ << 第一步,以root用户查看/etc/sudoers [root@ltt2 hadoop] ...
- linux给用户赋予root权限
1.到/etc目录下 2.使用 vi sudoers 3.将username添加到sudoers
- 04.给linux用户添加sudo权限
linux给用户添加sudo权限: 有时候,linux下面运行sudo命令,会提示类似: xxxis not in the sudoers file. This incident will be r ...
- Linux系统下给非root用户添加sudo权限
Linux系统下给非root用户添加sudo权限 有时,在linux系统中非root用户运行sudo命令,会提示类似信息: xxx is not in the sudoers file. This ...
- Linux中给普通用户添加sudo权限
使用Linux系统时,经常会被要求使用超级权限,但是root的权限太过大了,一般慎用!!!因此可以通过给普通用户添加sudo权限,平常用普通用户进行操作,当需要root权限的时候进行sudo操作.以下 ...
- Linux学习笔记之如何让普通用户获得ROOT权限
在学习sodu的时候,我发现一些命令只能由root用户使用,普通用户使用会提示此用户没有使用sudo的权限.我想到的解方法是把正在使用的普通用户获得root权限,于是我通过百度和询问老师知道了如何去实 ...
- linux gcc++漏洞:普通用户获得root权限
linux gcc++漏洞:普通用户获得root权限 2012-02-06 10:22:38| 分类: linux安全|举报|字号 订阅 经我测试在RHEL5 / CentOS5 / F ...
随机推荐
- [转]Linux网络 - 数据包的接收过程
转, 原文: https://segmentfault.com/a/1190000008836467 ------------------------------------------------- ...
- 【转】 Anatomy of Channels in Go - Concurrency in Go
原文:https://medium.com/rungo/anatomy-of-channels-in-go-concurrency-in-go-1ec336086adb --------------- ...
- Union-Find(并查集): Quick union improvements
Quick union improvements1: weighting 为了防止生成高的树,将smaller tree放在larger tree的下面(smaller 和larger是指number ...
- ContextLoaderListener解析
推荐:spring源码 每一个整合spring框架的项目中,总是不可避免地要在web.xml中加入这样一段配置. <!-- Spring配置文件开始 --> <context-par ...
- Docker 安装mysql、oracle
来源:唐山网站优化 Docker 安装mysql.oracle 使用ssh工具登录docker docker 的ip一般默认为192.168.99.100可以通过安装docker-machine之后, ...
- 2019-2020-1 20199312 《Linux内核原理与分析》 第九周作业
进程调度 1.中断:起到切出进程指令流的作用.中断处理程序是与进程无关的内核指令流.中断类型: 硬中断:可屏蔽中断和不可屏蔽中断.高电平说明有中断请求. 软中断/异常: 故障:出问题,但可以恢复到当前 ...
- MYSQL 常见引擎
Mysql常见的引擎 常用的引擎是:Innodb和Myiasm这两种引擎: innodb: 提供了对事务的ACID操作,还提供了行级锁和外键约束,,他的优势就是处理大量数据,在msql启动的时候, ...
- am335x system upgrade kernel gpio(九)
1 Hardware Overview gpio interface,pin map: AM335X_I2C0_W_C----------------------MCASP0_AXR1 /* ...
- ora-28000:the account is locked,Oracle修改密码有效期,Oracle设置密码不过期
查询Oracle用户是否被锁定 --例如我这里是VMCXEDDB 是否被锁定 select username,account_status,lock_date from dba_users where ...
- java连数据库和数据库连接池踩坑日记(一)-------oracle连接的一些问题
最近接触oracle有点多,同时也在配置数据库连接池,坑也就踩多了,记录下. 事情还没有结束,没时间记录问题,很多事情都忘了,过了国庆再写的话可能就真的全忘了吧……而且不单单是数据库问题,还有一些数据 ...