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 ...
随机推荐
- 《The One!团队》第八次作业:ALPHA冲刺(一)
项目 内容 作业所属课程 所属课程 作业要求 作业要求 团队名称 < The One !> 作业学习目标 (1)掌握软件测试基础技术.(2)学习迭代式增量软件开发过程(Scrum) 第一天 ...
- Django --- csrf相关,auth相关
目录 1.csrf相关 1.跨站请求伪造 2.跨站请求伪造问题解决 3.crsf中间件 4.csrf装饰FBV的装饰器 5.csrf装饰CBV的装饰器 6.django settings源码刨析 2. ...
- 如何从notepad++的偏移量查找
有的时候报错的会把偏移量直接报错给我们,我就需要根据偏移量定位我们的错误. 比如他报错偏移量1009. 做搜索(按Ctrl + F) 选择Regular expressions并确保有. matche ...
- linux下Boost序列化问题解决
由于项目需要,要使用boost,所以在网上找了一些例子帮助理解,其中遇到很多问题,再次总结记录一下.#include <boost/archive/text_oarchive.hpp> # ...
- 机器学习-- 入门demo1 k临近算法
1.k-近邻法简介 k近邻法(k-nearest neighbor, k-NN)是1967年由Cover T和Hart P提出的一种基本分类与回归方法. 它的工作原理是:存在一个样本数据集合,也称作为 ...
- The Last Goodbye 电影《霍比特人3:五军之战》插曲
https://music.163.com/#/song?id=29755223 I saw the light fade from the sky我看到天空褪去色彩On the wind I hea ...
- Jenkins 更改工作目录;
更改 Jenkins 工作目录:如果使用 tomcat 加载的 war包形式启动 默认配置文件 /root/.jenkins Jenkins 默认配置文件 /root/.jenkins/config ...
- 深入基础(四)Buffer,转码
Buffer 前面提及到一些关于buffer类的问题,当时不是很明确 那么就次机会顺便深入探讨一下这个东西到底干嘛的出现在什么时候,如何使用.昨天跟朋友聊天他说我每一篇博文内容太长太长了 虽然 ...
- AtCoder Grand Contest 007题解
传送门 \(A\) 咕咕咕 //quming #include<bits/stdc++.h> #define R register #define fp(i,a,b) for(R int ...
- Linux使用logrotate定时分割日志
1.分割nginx日志vim /etc/logrotate.d/nginx/var/log/nginx/*log { create 0644 nginx nginx rotate 10 missing ...