当前位置: 首页 > 知识库问答 >
问题:

在Linux系统中安装java时出错

高寒
2023-03-14

当我在linux系统上安装Java8时,Iam得到以下错误-sudo:effective uid不是0,安装的sudo是setuid root吗?请帮帮忙。下面是System的sudoer文件。请帮助。

/>mv/usr/lib/java-1.8.0/jdk1.8.0_161/usr/lib/java/>sudo更新-备选项--安装“/usr/bin/java”“java”“/usr/lib/jdk1.8.0_161/bin/java”1 sudo:有效的uid不是0,安装的sudo是setuid root吗?/>ls-l$(which sudo)-rwxrwxrwx。1 root root 123832 2014年10月15日/usr/bin/sudo/>chmod u+s/usr/bin/sudo chmod:更改`/usr/bin/sudo'的权限:不允许操作/>

 />mv /usr/lib/java-1.8.0/jdk1.8.0_161 /usr/lib/java
    />sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jdk1.8.0_161/bin/java" 1
    sudo: effective uid is not 0, is sudo installed setuid root?
    />ls -l $(which sudo)
    -rwxrwxrwx. 1 root root 123832 Oct 15  2014 /usr/bin/sudo
    />chmod u+s /usr/bin/sudo
    chmod: changing permissions of `/usr/bin/sudo': Operation not permitted
    />
Sudoer File
## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## 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.

## 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

## 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


## Command Aliases
## These are groups of related commands...

## Networking
# Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool

## Installation and management of software
# Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum

## Services
# Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig

## Updating the locate database
# Cmnd_Alias LOCATE = /usr/bin/updatedb

## Storage
# Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount

## Delegating permissions
# Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp

## Processes
# Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall

## Drivers
# Cmnd_Alias DRIVERS = /sbin/modprobe

# Defaults specification

#
# Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
#         You have to run "ssh -t hostname sudo <cmd>".
#
Defaults    requiretty

#
# Refuse to run if unable to disable echo on the tty. This setting should also be
# changed in order to be able to use sudo without a tty. See requiretty above.
#
Defaults   !visiblepw

#
# Preserving HOME has security implications since many programs
# use it when searching for configuration files. Note that HOME
# is already set when the the env_reset option is enabled, so
# this option is only effective for configurations where either
# env_reset is disabled or HOME is present in the env_keep list.
#
Defaults    always_set_home

Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"

#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults   env_keep += "HOME"

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
Type  :quit<Enter>  to exit Vim

共有1个答案

冯飞鹏
2023-03-14

您的sudo权限在我看来可疑:

-rwxrwxrwx. 1 root root 123832 Oct 15  2014 /usr/bin/sudo

基本上这意味着,任何人都可以写信给它。在我看来这是个弱点。我观察了sudo可执行文件的文件权限,如下所示:

-rwsr-xr-x (MacOS)
-r-s--x--x (FreeBSD)
---s--x--x. (CentOS 7)

你确定你的系统完好无损吗?

su root -c chmod u+s /usr/bin/sudo

但这只是治愈症状,你应该检查你的系统。

 类似资料:
  • 主要内容:得到NTFS文件系统模块后,手工安装,利用 NTFS-3G 插件安装 NTFS 文件系统模块在 CentOS 6.x 中,默认 NTFS 文件系统是没有安装的,也就是说在 CentOS 6.x 中是不能直接挂载 NTFS 分区的。但是目前 Windows 的分区绝大多数是 NTFS 分区,这就需要在 CentOS 6.x 中安装 NTFS 文件系统的模块之后,才能使用 NTFS 分区。 安装 NTFS 文件系统模块的方法有三种: 第一种方法是完整地重新编译内核,然后在内核中选择 NTF

  • 因为笔者一直都是使用 CentOS,所以这次安装系统也是基于CentOS的安装。把光盘插入光驱,设置bios光驱启动。进入光盘的欢迎界面。也可参考Ubuntu 12.04 安装教程详细步骤。 其中有两个选项,可以直接按回车,也可以在当前界面下输入 linux text 按回车。前者是图形下安装,可以动鼠标的,后者是纯文字形式的。建议初学者用前者安装。直接回车后,出现一下界面: 这一步是要提示你是否

  • 通过前面的小节学习,我们已经对 Linux 操作系统有了简单的了解,同时也在 Windows 下安装了虚拟机软件 VMware ,那么本节课我们就介绍下如何使用虚拟机软件安装 Linux 操作系统。 通过第一小节的学习我们知道 Linux 有很多的发行版本,本小节以 CentOS 8 为例来介绍 Linux 操作系统的安装步骤。学习本小节之后读者可以按照本小节的介绍步骤,安装其他的 Linux 操

  • 本文向大家介绍在linux系统下安装redis的方法,包括了在linux系统下安装redis的方法的使用技巧和注意事项,需要的朋友参考一下 去官网找到合适的版本,可以直接下载下来,再用fxp上传,也可以直接以下面这种方式下载: 启动服务: 测试是否成功: 以上所述是小编给大家介绍的在linux系统下安装redis的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也

  • 主要内容:VMware下载和安装,VMware 安装 Linux 系统许多新手连 Windows 的安装都不太熟悉,更别提 Linux 的安装了;即使安装成功了,也有可能破坏现有的 Windows 系统,比如导致硬盘数据丢失、Windows 无法开机等。所以一直以来,安装 Linux 系统都是初学者的噩梦。 然而,通过虚拟机技术很容易冲破这种困境。由于虚拟机安装 Linux 所有的操作(例如硬盘分区、删除或修改数据)都是在虚拟硬盘中进行,因此不会对现有的数据和系统造

  • 本文向大家介绍linux系统安装Nginx Lua环境,包括了linux系统安装Nginx Lua环境的使用技巧和注意事项,需要的朋友参考一下 亦可参考官方安装指南: lua-nginx-module Installation 这是我总结的安装,供参考: 需要最新版的Nginx,LuaJIT,ngx_devel_kit,lua-nginx-module等安装文件: Nginx LuaJIT Lua