Is the Command I’m Running Risky?

0
6
Asked By CuriousCoder99 On

I came across this command in a script and I'm wondering if it's dangerous to run:

```bash
sudo cp -R $TEST_PG_DIRECTORY/root /
```

Here's some context: The command caused issues, and I suspect it's related to the permissions of the `sudo` binary because I started getting errors like:

```bash
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
```

Have I messed something up? What should I watch out for?

4 Answers

Answered By CautiousNerd88 On

Honestly, without more context, you might just get a "No such file or directory" error if `$TEST_PG_DIRECTORY` isn't properly defined. Try running `echo $TEST_PG_DIRECTORY` to see what it outputs and ensure it points to the right directory. If everything in `$TEST_PG_DIRECTORY/root` gets copied to your root filesystem, you could overwrite sensitive system files like `sudo` if you're not careful!

CuriousCoder99 -

It's defined; I checked.

Answered By NerdyNomad77 On

Did you copy something from a chatbot's suggestion into your terminal? If so, what was the initial request? That's usually a recipe for disaster if you don't fully understand the commands you're running.

Answered By SkepticGamer21 On

Just a note, but if you copied over something critical or modified your `sudo` file, it could really complicate matters for you. I’d be cautious and double-check the contents of that directory before running any such command!

Answered By HelpfulHamster42 On

It would help to know what you're trying to achieve with that command. If you're not careful, it can mess up your hard drive, especially if permissions aren't set right. But overall, it’s not inherently dangerous by itself unless the `TEST_PG_DIRECTORY` contains something harmful.

CuriousCoder99 -

Well, it messed up my sudo binary by changing the permission bits.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.