18 сент. 2014 г. · Short answer - you can't. The sudo su starts a new shell which must exit before it gets to the cd command. |
13 июн. 2012 г. · You could use sudo -s instead, it would not change your current directory to /root , though some of your environment variables would not be ... |
19 дек. 2022 г. · It is because you are using $USERNAME . You can easily see this in action: $ bash -c 'echo "USERNAME is $USERNAME"' USERNAME is terdon ... |
30 мар. 2021 г. · You can't; changing the directory is part of what sudo -i does. But you can just go back to where you were and then run the command: |
4 июл. 2016 г. · Try using either su - or sudo -i before changing directory. These will elevate your login session to that of the root user. |
21 авг. 2021 г. · I need this to print the /home/user directory in the WSL instance even when running as sudo . I achieved this by running this as sudo -E but I ... |
19 сент. 2013 г. · sudo -s preserves HOME on Ubuntu, while on Debian HOME is erased and sudo then sets it to the home directory of the target user. |
26 июл. 2020 г. · If you want to change directory to /root and stay there then you need a shell with the correct UID, hence your sudo su and cd /root (or, even, just cd ) work ... |
11 мар. 2023 г. · In troubleshooting vi , I noticed on my Ubuntu installation running the command sudo env | grep HOME returns the home directory of the user that ... |
30 сент. 2013 г. · If you want to change to a directory and then run commands as another user, run a shell that does all that. sudo -u SOMEUSER sh -c 'cd /path ... |
Novbeti > |
Axtarisha Qayit Anarim.Az Anarim.Az Sayt Rehberliyi ile Elaqe Saytdan Istifade Qaydalari Anarim.Az 2004-2023 |