【Centos7进入root权限是报错:sudo: /etc/sudo.conf is owned by uid 1000, should be 0】

将远程服务器设置为禁止使用root登录,在使用用户登录后,进入root权限失败
,这是由于在Centos上安装ftp服务时错误的批量修改了系统根目录全部文件的权限,导致进入root权限时出现报错:

sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

执行命令

chown root:root /etc/sudo.conf -R
chmod 4755 /usr/bin/sudo

执行sudo ,出现错误

su: Authentication failure

执行命令

chown -R root:root /etc/sudoers.d
chown root:root /etc/sudoers

执行sudo命令,出现错误

sudo: error in /etc/sudo.conf, line 19 while loading plugin "sudoers_policy"
sudo: /usr/libexec/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins

执行命令 =====》

chmod 644 /usr/libexec/sudo/sudoers.so
chown -R root /usr/libexec/sudo/

执行sudo,出现错误

sudo: /var/db/sudo/lectured is owned by uid 1000, should be 0
dog is not in the sudoers file.  This incident will be reported.

执行命令

chown root:root /var/db/sudo/lectured/

执行命令sudo,出现错误

dog is not in the sudoers file.  This incident will be reported.

执行命令

[root@myyuncentos ~]# chmod u+x /etc/sudoers
[root@myyuncentos ~]# vi /etc/sudoers

找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)
执行命令

chmod u-w /etc/sudoers

在执行sudo,输入密码可以进入root权限了====》

在sudoers文件中,可以sudoers添加下面四行中任意一条
youuser ALL=(ALL) ALL  //允许用户youuser执行sudo命令(需要输入密码).
%youuser ALL=(ALL) ALL	//允许用户组youuser里面的用户执行sudo命令(需要输入密码).
youuser ALL=(ALL) NOPASSWD: ALL   //允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
%youuser ALL=(ALL) NOPASSWD: ALL   //允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.
  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Centos7发布说明 环境说明: 服务器系统:CentOS 7.2.1511 相关工具:Xshel、Xftp 服务器软件软件:.netcore、nginx、supervisor 准备好发布的程序 安装.NET Core SDK for CentOS7 打开网址:https://www.microsoft.com/net/core#linuxcentos 复制如下命令,单步执行: sudo yum install libunwind libicu curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835019 sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet sudo ln -s /opt/dotnet/dotnet /usr/local/bin 输入 dotnet –info 来查看是否安装成功 配置Nginx 下载安装Nginx,单步执行如下命令: curl -o nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm rpm -ivh nginx.rpm yum install nginx systemctl start nginx 来启动nginx systemctl enable nginx 来设置nginx的开机启动(linux宕机、重启会自动运行nginx不需要连上去输入命令)。 配置防火墙 命令:firewall-cmd --zone=public --add-port=80/tcp --permanent(开放80端口) 命令:systemctl restart firewalld(重启防火墙以使配置即时生效) 测试nginx是否可以访问。 配置nginx对ASP.NET Core应用的转发 修改 /etc/nginx/conf.d/default.conf 文件,将文件内容替换为: server { listen 80; location / { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
【资源说明】 基于大数据分析与可视化的疫情信息发布平台源码+项目部署教程.zip 基于大数据分析与可视化的疫情信息发布平台源码+项目部署教程.zip 基于大数据分析与可视化的疫情信息发布平台源码+项目部署教程.zip 1、该资源内项目代码都是经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能。 1.首先找到config/index.js文件,将assetPublicPath的路径改为“./” 2.在build目录下utils.js修改,找到如下配置添加publicPath: '../../' ``` if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader', publicPath: '../../', //添加上的 }) } else { return ['vue-style-loader'].concat(loaders) } ``` 3.npm run build产生dist文件夹 安装nginx ``` sudo yum -y install nginx sudo systemctl start nginx 如果想在系统启动时启用Nginx。请输入以下命令 sudo systemctl enable nginx ``` 上传部署 ``` 将dist文件夹上传到服务器 vi /etc/nginx/nginx.conf 在include /etc/nginx/default.d/*.conf;下方 location / { root /var/myapp/dist/; index index.html index.htm; try_files $uri $uri/ /index.html; } sudo systemctl restart nginx ``` # 后端部署 python3安装 ``` 安装必要工具 yum-utils ,它的功能是管理repository及扩展包的工具 sudo yum install yum-utils 使用yum-builddep为Python3构建环境,安装缺失的软件依赖,使用下面的命令会自动处理 sudo yum-builddep python 完成后下载Python3的源码包 curl -O https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz 最后一步,编译安装Python3,默认的安装目录是 /usr/local tar xf Python-3.7.6.tgz cd Python-3.7.6 ./configure make sudo make install #如果你要使用Python3作为python的默认版本,你需要修改一下 #bashrc 文件,增加一行alias参数 #alias python='/usr/local/bin/python3.7' 由于CentOS 7建议不要动/etc/bashrc文件,而是把用户自定义的配置放入/etc/profile.d/目录中,具体方法为 vi /etc/profile.d/python.sh 写入 alias python='/usr/local/bin/python3.7' chmod 755 /etc/profile.d/python.sh 重启会话使配置生效 source /etc/profile.d/python.sh ``` 安装需要的库 后台运行 ``` nohup /usr/local/bin/python3.7 -u app.py > test.log 2>&1 & 定时运行 用如下命令查看当前系统中的定时任务列表 crontab -l 对crontab进行编辑 crontab -e 这里设置的是每天6,、12、20点整运行脚本 0 6,12,20 * * * /usr/local/bin/python3.7 /home/ec2-user/cov19/app.py > /home/ec2-user/cov19/auto.log 完成后,可以重启一下crontab的服务即可 service crond restart ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Michael.Scofield

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值