에서 su
의 매뉴얼 페이지
For backward compatibility, su defaults to not change the current directory
and to only set the environment variables HOME and SHELL (plus USER and LOGNAME
if the target user is not root). It is recommended to always use the
--login option (instead of its shortcut -) to avoid side effects caused
by mixing environments.
...
-, -l, --login
Start the shell as a login shell with an environment similar to a real login:
o clears all the environment variables except TERM
o initializes the environment variables HOME, SHELL, USER, LOGNAME, and PATH
o changes to the target user's home directory
o sets argv[0] of the shell to '-' in order to make the shell a login shell
-
와 --login
(또는 아마도 그냥 -l
) 차이가 있는지 말하기는 어렵습니다 . 즉, 매뉴얼 페이지에 "바로 가기 대신-"가 표시되지만 이러한 모든 옵션이 함께 그룹화되어 있으며 차이가있을 경우 그 차이점에 대한 설명을 볼 수 없습니다.
UPD 나는 문제 를 해결하기 위해 질문을 확인했다 . 문제는 기본적으로 su
와의 차이점에 관한 것 su -
입니다. 그리고 차이에 대해 부탁 해요 su -
와 su --login
. 아니, 전혀 해결되지 않습니다.
중복에 대한 귀하의 정의는 모르지만 제 질문은 그렇게 고려하지 않습니다. 제안하는 질문은 기본적으로
—
x-yuri
su
와의 차이점에 관한 것 su -
입니다. 그리고 차이에 대해 부탁 해요 su -
와 su --login
. 내가 여기서 무엇을 놓치고 있습니까?
To avoid side effects caused by mixing environments use --login option or its equivalent -. The first form is recommended because - can be placed only just before username.