When use sudo -i I will simulate login as root, and current working directory will be jumped to /root.
Is it possible not to jump and keep the working directory unchanged?
Do you need to simulate an initial log in, you can use sudo -s to just get a root shell.
sudo -i "cd `/bin/pwd` ; /bin/bash"
-bash: cd /path/to/current/dir ; /bin/bash: No such file or directory
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3 years ago
1 year ago