이것은 12.04 ec2 인스턴스 용입니다.
man 페이지에는 sudo를 사용할 때 암호를 요구하는 것이 기본값이라고 나와 있습니다. sudo를 사용할 때 암호를 묻는 메시지가 나타날 수있는 우분투의 계정 암호 (설정되지 않은 경우)를 설정하는 것으로 생각했지만 passwd 명령을 사용할 때 변경을 허용하기 전에 원래 암호를 입력해야했습니다 . 따라서 이미 설정된 것처럼 보이지만 sudo 패스를 요구하지 않았고 sudo를 사용하여 우분투 계정 암호를 재정의하고 변경 한 후에도 여전히 sudo 패스를 요구하지 않습니다.
어쨌든, 그 세부 사항이 실제로 얼마나 중요한지 잘 모르겠습니다. 다음은 내 sudoers 파일입니다.
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
모든 예에서 사람들이 암호없는 sudo 설정을 사용하는 이유를 알지 못하는 경우 sudoers 파일에 명시적인 "NOPASSWD : ALL"줄 (내가 가지고 있지 않음) 때문인 것 같습니다. . 나는 시도했다 :
%admin ALL:(ALL) PASSWD: ALL
하지만 도움이되지 않았습니다.
id 출력 :
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),110(netdev),111(admin)
ubuntu
사용자 나이 실제 환경의 일종이라고 생각합니다. 라이브 환경에서 ubuntu
사용자는 암호없이 sudo
액세스 할 수 있습니다. 이것이 라이브 환경의 목적이기 때문입니다.
위의 경우 비밀번호없는 sudo
액세스는 /etc/sudoers.d/
디렉토리 의 파일에 정의되어 있으며 , 더 정확하게는 다음을 /etc/sudoers.d/casper
포함합니다.
ubuntu ALL=(ALL) NOPASSWD: ALL
그래서 나는 당신이 /etc/sudoers.d/
디렉토리 에 그러한 파일을 가지고 있다고 생각합니다 . (또는 비표준 우분투 설치가있는 경우 동일한 목적을 가진 다른 유사한 파일.) 해당 파일을 제거하거나 원하는 방식으로 편집해야합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다