代码先锋网 代码片段及技术文章聚合

Do not run Composer as root/super user

忙着安装composer ,执行后,查看版本,报了这样一个提示:

[root@izuf60gbaaaq66y42r6y2fz ~]# composer --version
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Composer version 1.6.5 2018-05-04 11:44:59
[root@izuf60gbaaaq66y42r6y2fz ~]# whoami
root
[root@izuf60gbaaaq66y42r6y2fz ~]#

大惊,怎么在root用户下执行了这一系列操作,确实很不像话,很不专业。于是,添加个普通用户:

adduser Abble
passwd

但,个人用户的权限有时远远满足不了开发需求。它只在home目录下有完整的权限,在其它目录下取决于root的授权。由于是个人开发,我希望Abble可以得到root的权限。于是,想起了sudo -s

[root@izuf60gbaaaq66y42r6y2fz ~]# su Abble
[Abble@izuf60gbaaaq66y42r6y2fz root]$ whoami
Abble
[Abble@izuf60gbaaaq66y42r6y2fz root]$ sudo -s

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for Abble: 
Abble 不在 sudoers 文件中。此事将被报告。

很明显,执行失败。我们要在sudoers中配置一下:

[root@izuf60gbaaaq66y42r6y2fz ~]# whereis sudoers
sudoers: /etc/sudoers /etc/sudoers.d /usr/libexec/sudoers.so /usr/share/man/man5/sudoers.5.gz
[root@izuf60gbaaaq66y42r6y2fz ~]# vim /etc/sudoers
[root@izuf60gbaaaq66y42r6y2fz ~]# 
## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
# Abble ALL=(ALL)       ALL # 个人新增的一个用户,并且给它权限做事
Abble   ALL=(ALL)       NOPASSWD:ALL # 个人新增的一个用户,并且给它权限做事

如此,两个用户可以快速转化:

[Abble@izuf60gbaaaq66y42r6y2fz root]$ whoami
Abble
[Abble@izuf60gbaaaq66y42r6y2fz root]$ sudo -s
[root@izuf60gbaaaq66y42r6y2fz ~]# whoami
root
[root@izuf60gbaaaq66y42r6y2fz ~]# su Abble
[Abble@izuf60gbaaaq66y42r6y2fz root]$ whoami
Abble
[Abble@izuf60gbaaaq66y42r6y2fz root]$ 
版权声明:本文为weixin_34352005原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_34352005/article/details/87571429

智能推荐

The user specified as a definer (‘root‘@‘%‘) does not exist

在执行存储过程时报此错误 1449 - The user specified as a definer (‘root’@’%’) does not exist 给root用户加权限 刷新权限 mysql grant 用户权限总结...

The user specified as a definer (‘root‘@‘%‘) does not exist

The user specified as a definer (‘root’@’%’) does not exist 前提: Mysql 8.0 版本 安装在window系统上。 描述: 最近一个活,运维新安装了mysql8.0在线上,程序部署上去后各种问题。这套程序有使用视图,代码代码中运行提示 The user specified as a d...

The user specified as a definer (‘root‘@‘%‘) does not exist

使用mysql视图是出现问题: The user specified as a definer (‘root’@’%’) does not exist 访问视图文件没有权限引起的 重启之后会失效, 建议:修改创建者用户为本用户 数据库从别的地方导过来也会出现这个问题 The user specified as a definer (‘wb...

If you insist running as root, then set the environment variable RUN_AS_USER=root before running thi

今天在linux上面使用 nexus 的时候,在启动的时候出现了上述的错误,在进行百度之后,发现问题也没有解决,在细心的查看下,发现是很多博客的博主都写的错误,导致后续的人也出现了错误,先看看解决的方法吧,大家都是两种方法去解决,一种的临时方法 一种是永久的方法,临时的方法设置过后,关闭客户端再次就不能用了 临时方法: export RUN_AS_USER=root 后在执行 ./nexus st...

Linux终端出现:To run a command as administrator (user “root“), use “sudo <command>“.

Linux终端出现:To run a command as administrator (user “root”), use "sudo ". 解决办法:...

猜你喜欢

npm 发布包报错:You do not have permission to publish "XXX". Are you logged in as the correct user?

问题 这是由于包名重复造成的原因,更换包名即可。...

解决vscode安装提示This User Installer is not meant to be run as an Administrator问题

以前一直用sublime_Text作为开发工具,最近看到很多用vscode,今天突然想到安装个体验一下,直接在浏览器搜索vscode,下载点击安装,没想到就给弹出这个错误窗口 什么鬼,直接打开提供的网址,进入下载页面 https://code.visualstudio.com/Download 竟然发现vscode由两个版本,下载 System Installer 版本的,安装一切顺利。...

ubunt与win10之间复制粘贴 Please re-run this program as the super user

为了能够在linux和windows之间直接进行互相复制粘贴,给出下面的解决办法。 系统环境: ubuntu18.04(lts) win10系统 以下指令都是在超级用户的执行权限下执行的。 要解决这个问题,只需要在ubuntu安装一个vmware-tools的工具就可以了。 1.打开虚拟机的菜单“vm” 里面的下拉框中会有一个vmware tools工具的安装选项。 点击之...

Ubuntu运行Chrome出现“Google Chrome can not be run as root” 的解决方法

Ubuntu中root用不能打开Chrome浏览器解决方法: 找到启动文件 :/opt/google/chrome/google-chrome 编辑该文件,修改最后一行: to...