Debian sudo command not found9/26/2023 ![]() ![]() I can make this happen by logging out and in again. Now I have done this I only need to refresh the group permissions of the user. ![]() Where chewett is the name of the user you want to give the sudo rights to. To do this you can run the command usermod -aG sudo chewett So that I can give myself rights to use sudo I can add myself to the group sudo. If you run the sudo command without rights it will fail with a warning message. Once a user has installed sudo you will need to give an account the right to run sudo. After some research I found that if you set a root password you need to install sudo manually. To my surprise I ran sudo on Debian 9 and it returned sudo command not found. Over the past weeks I have been reviewing other Linux operating systems. This means that instead of opening a root console with su I only run the command I want to as root. I use sudo to run a specific command that needs administrative privileges on my computer. Sudo is general way of running something under the root user. In order to pass environment variables, you can either tell sudo to preserve the environment (via the -E switch and having appropriate permissions in your sudoers file) and/or setting it for the command as sudo VAR1=VALUE1 VAR2=VALUE2 command.AIn this blog post I describe why you get sudo command not found on Debian and what you can do to fix it. However, due to how sudo works (as stated in its manpage), sudo tries to strip the environment of the user and create a "default" environment for the supplanting user, so that the command run is run as if the user who invoked it had been the calling user (which is the expected behaviour), and thus running nautilus as sudo nautilus should open a folder at the /root folder, and not /home/yourusername.ĭoing something like sudo source script.sh and then sudo command, even if it worked, it wouldn't be successful at setting any variable to the later sudo command. typing bash inside a bash instance) and looking at the output of env should give similar results than its parent. ![]() And they work like this:Įvery time a new process is started, if nothing happens, it inherits the environment of its parent. The actual problem is how environment variables work. The fact that it is is what's actually throwing you the command not found error, but it doesn't mean it would work if it were. The problem is not that source is a shell builtin command. The first would output the variable's value, but the second wouldn't output anything. I proved this by testing with these simple commands: echo $ENV_VARIABLE I found that while they could access the variables when I called the scripts directly (although, this would cause a later problem with creating directories as I needed to be root), calling the install scripts using sudo wouldn't. Initially, I was using some installer scripts which referenced the variables. Is there a simple way to load in the new bash profile settings for sudo without having to close the terminal and restart? I get the error: sudo: source: command not found When I try to use: sudo source /etc/bash.bashrc They only became available to sudo when I closed my terminal session and rejoined. The only thing is - the new environment variables were only available to my current user - and were ignored when I used sudo. I've been updating some of the default profile for bash, and saw from the tutorials I was following that I could reload the new profile with the new environment settings by using: source /etc/bash.bashrc ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |