I am trying to install nightly rust on a new computer running ubuntu, and all the commands (rustc, cargo, rustup) are working, but only if I do not run them as root. For example, if I want to build a program without using sudo, it will say:
error: failed to open: /home/thiv/project/target/debug/.cargo-lock Caused by: Permission denied (os error 13)
Naturally, I tried to use "sudo cargo build", but the terminal responds with:
sudo: cargo: command not found
How do I fix this?