sudoedit

sudoedit

info
namesudoedit
full namesudoedit
aliasessudoedit
tagssudoedit

권한이 필요한 파일을 직접 root 권한 editor로 열지 않고, 임시 복사본 편집 후 안전하게 반영하는 sudo의 edit mode.

  • sudoedit는 실제 editor를 target user 권한이 아니라 invoking user 환경으로 실행하고, 수정 결과만 원본 파일에 반영한다.
  • 일반적으로 system config를 수정할 때 sudo vim /etc/file 보다 안전한 선택지로 취급된다.
  • 실행 시 내부적으로 sudo -e와 같은 의미로 동작한다.
  • 이 페이지의 동작 설명은 로컬 man sudoedit 기준으로 정리했다.
sudoedit /etc/hosts
sudoedit /etc/ssh/sshd_config
sudoedit -u root /etc/fstab
sudoedit -n /etc/sudoers
sudo -e /etc/hosts
  • sudoedit FILE…
  • sudoedit -u USER FILE…
  • sudoedit -n FILE…
  • sudo -e FILE…
  • -u USER: 기본 target user 대신 다른 user 기준으로 파일 권한 검사를 수행한다.
  • -n: password prompt를 띄우지 않는다. 인증이 필요하면 즉시 실패한다.
  • -S: password를 terminal 대신 stdin에서 읽는다.
  • -A: askpass helper를 사용한다.
  • -p PROMPT: custom password prompt를 지정한다.
  • -T TIMEOUT: command timeout을 지정한다. policy가 허용해야 한다.
  • -D DIR: editor 실행 전 working directory를 바꾼다.
  • -R DIR: chroot directory를 지정한다.
  • -C NUM: 지정한 fd 이상을 닫는다. policy 제한을 받는다.
  • -h: short help를 출력한다.
  • : 뒤 인자를 path로만 해석한다.
sudoedit /etc/hosts
sudoedit /etc/ssh/sshd_config
EDITOR=nvim sudoedit /etc/fstab
SUDO_EDITOR="code --wait" sudoedit /etc/hosts
sudoedit -n /etc/hosts
sudo -e /etc/cron.d/app
  • editor 선택 우선순위: $SUDO_EDITOR$VISUAL$EDITOR
  • 위 환경 변수가 없으면 sudoerseditor 설정을 따른다.
  • sudoedit는 editor를 invoking user 환경으로 실행하므로, root 전용 shell rc나 root home에 의존하는 workflow와는 다르게 동작할 수 있다.
  • sudoedit: command not found 또는 별도 binary가 없으면 보통 sudo -e로 같은 동작을 사용할 수 있다.
  • symbolic link나 user writable directory 경로는 policy와 sudo 버전에 따라 편집이 차단될 수 있다.
  • 임시 파일 저장 후 원본 반영 단계에서 실패하면 경고와 함께 수정본이 temporary file로 남을 수 있다.
  • sudoedit 자체가 ownership 또는 setuid 오류를 내면 sudo package 설치 상태가 깨졌을 가능성이 크다.
  • sudoedit는 사실상 sudo front-end의 edit mode다.
  • local man page 기준으로 symbolic link 편집 차단은 sudo 1.8.15+, user writable path 제한은 1.8.16+ 설명이 포함돼 있다.
  • 배포판 policy plugin이나 sudoers 설정에 따라 허용 옵션과 password 동작이 달라질 수 있다.
  • privileged file을 직접 sudo vim /etc/file 형태로 여는 방식은 plugin, swap, backup, shell escape 관점에서 더 위험할 수 있다.
  • sudoedit가 있는 환경에서는 config file 수정에 edit mode를 우선 고려하는 편이 안전하다.
  • sudo -esudoedit와 같은 의미다.
  • syntax 검증이 필요한 정책 파일은 visudo 같은 전용 validator와 함께 쓰는 편이 낫다.
  • GUI editor를 쓸 때는 –wait 성격의 옵션이 필요할 수 있다.

man sudoedit synopsis and edit behavior

  • codex:: 2026-07-16 Added sudoedit reference page with safe edit workflow, environment selection, and troubleshooting notes.
  • /home/u613600155/domains/cli.zerotymer.net/public_html/data/pages/sudoedit.txt
  • 마지막으로 수정됨: 2026/07/16 05:18
  • 저자 writer