一般ユーザーの資格情報を使用するときにrootとしてログインするのはなぜですか?

一般ユーザーの資格情報を使用するときにrootとしてログインするのはなぜですか?

CentOS 6.8サーバーにGNOMEをインストールし、WindowsでNOMACHINE NXソフトウェアを介してログインしました。ログイン時に一般ユーザーとパスワードを使用したのにルートです。私はルートになりたくありません。この動作を得るには、Linux設定をいくつか変更する必要がありました。私はいつもパスワードを求めるのに疲れていたので、以前は「admin」、「root」、「wheel」などのグループに自分のユーザーを追加したことを知っています。 sudoersを編集してコメントを解除しました。

%wheel ALL=(ALL)       NOPASSWD: ALL

しかし、ある時点で私はもはや私のユーザーではなく、私の資格情報を使用してログインしましたが、常にルートであることに気づきました。これで、通常のユーザーに戻そうとしていますが、元に戻すことはできません。

私はsudoersに答えた。私のsudoers.dは空です。ユーザーグループを除くすべてのグループをユーザーから削除しました。 SSHで試してみましたsudo su

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

一般ユーザーとしてGNOMEにログインするために何ができるのかわかりません。


要求された情報:

grep myuser /etc/passwd

myuser:x:502:502::/home/myuser:/bin/bash

情報要求2:

grep root/etc/passwd

root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin

#.bash_configファイル

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

#.bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

# are we an interactive shell?
if [ "$PS1" ]; then
  if [ -z "$PROMPT_COMMAND" ]; then
    case $TERM in
    xterm*)
        if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
            PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
        else
            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
        fi
        ;;
    screen)
        if [ -e /etc/sysconfig/bash-prompt-screen ]; then
            PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
        else
            PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
        fi
        ;;
    *)
        [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
        ;;
      esac
  fi
  # Turn on checkwinsize
  shopt -s checkwinsize
  [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
  # You might want to have e.g. tty in prompt (e.g. more virtual machines)
  # and console windows
  # If you want to do so, just add e.g.
  # if [ "$PS1" ]; then
  #   PS1="[\u@\h:\l \W]\\$ "
  # fi
  # to your custom modification shell script in /etc/profile.d/ directory
fi

if ! shopt -q login_shell ; then # We're not a login shell
    # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
    pathmunge () {
        case ":${PATH}:" in
            *:"$1":*)
                ;;
            *)
                if [ "$2" = "after" ] ; then
                    PATH=$PATH:$1
                else
                    PATH=$1:$PATH
                fi
        esac
    }

    # By default, we want umask to get set. This sets it for non-login shell.
    # Current threshold for system reserved uid/gids is 200
    # You could check uidgid reservation validity in
    # /usr/share/doc/setup-*/uidgid file
    if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
       umask 002
    else
       umask 022
    fi

    # Only display echos from profile.d scripts if we are no login shell
    # and interactive - otherwise just process them to set envvars
    for i in /etc/profile.d/*.sh; do
        if [ -r "$i" ]; then
            if [ "$PS1" ]; then
                . "$i"
            else
                . "$i" >/dev/null 2>&1
            fi
        fi
    done

    unset i
    unset pathmunge
fi
# vim:ts=4:sw=4

ベストアンサー1

これはLinuxとは無関係で、NoMachineサーバー構成、特に次のように設定した場合はserver.cfgファイルです。

CreateDisplay 1
DisplayOwner root

GNOME の root 権限を取得するには、次を参照してください。https://www.nomachine.com/TR04N06814&tn=DisplayOwner

どうやら私が自分で変更した内容を忘れてしまったようです。

おすすめ記事