🌑

工作備忘錄

Linux修改登入時的目錄位置

目標為修改所有使用者登入目錄位置預設為根目錄;

在/etc/profile.d 目錄下新增change-directory-to-root.sh,內容為

eval "$( bash -c 'echo "cd /"' )"

(如果是用

cd / && bash

,會再產生一個子進程,退出要執行2次exit。)

參考來源:shell script - changing current directory from child process - Unix & Linux Stack Exchange

— 2023年9月14日

Search