Skip to main content
Topic: Root privlidges folder (Read 319 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Root privlidges folder

I'm trying to make a cli script but I can not get into /etc/wireguard. It says permission denied. I thought you could get into anything with sudo. Things I've tried.
Running sudo cd /ect/wireguard
Running sudo usermod -a -G root michael

 

Re: Root privlidges folder

Reply #1
What are you wanting to do with your script ?

The approach you may need to take is write your script and then run the script with elevated privileges. So (to run as root)
Code: [Select]
sudo MYSCRIPT
or (as a specific USER)
Code: [Select]
sudo -u USER MYSCRIPT
sudo cd won't work as cd is a command builtin to the shell, eg bash.

sudo usermod -a -G root michael will add michael to group 'root' but that's not the same as full root privileges. Every file and directory has its own permissions and some don't allow even read access to group root.

I would suggest removing yourself from group root as there are better ways to do this. And possibly security implications ?

What is the output of
Code: [Select]
ls -dal /etc/wireguard
As a caveat:
If you write a script and run it as root any mistakes you make can potentially damage your install.
While you're learning be careful and consider testing things within a virtual machine.