I downloaded Kali linux, great os if you ask me, but I want to set the PATH to /sbin/
How do I do that, I want to set it permanantly and how do I make my account root so that I can create new files in /etc ... and so forth?

Normally, you should have sudo privileges. In that case, you can run any commands you want under root-privileges by writing sudo before it, like:

$ cd /sbin/
/sbin$ sudo mkdir test_dir
[sudo] password for YOUR_USERNAME: 
/sbin$ cd test_dir
/sbin/test_dir$ 

To actually switch the root user within a command terminal (for all subsequent commands), you can do sudo su (i.e., su means "super-user", another name for "root" user). Simply as so:

/sbin$ sudo su
[sudo] password for YOUR_USERNAME: 
/sbin#

(notice that the dollar sign becomes a # sign when you are logged as root. And you type the command exit to go back to normal user account. Of course, this only applies to that terminal session.

As root user (through sudo su) you can also change the root password with the command passwd. Afterwards, you can login as username "root" and with that password. However, it is not recommended to ever do that. You should just use sudo whenever you need to do things that require root privileges, and use sudo su occasionally when you want to do many root-privilege commands.

As for setting things like the PATH variable, these things are usually set in the .bashrc file in your user's home folder. This is a kind of "loading personal settings" file. There are also other files for that, I'm not sure anymore which.

Actually Mike, you don't want to set PATH in .bashrc, as it is executed on each invocation of bash, sometimes resulting in PATH variables like "/sbin:/sbin:/sbin:/usr/bin:...". Path should only be set (in my opinion) in .bash_profile, or in a manually run script when you need to temporarily add a new link to PATH.

Thanks for the clarification, the whole bashrc / bash_profile / profile business is confusing sometimes.

NP Mike. I've run into the "massively concatenated environment variable" issue before, even to the point of exceeding the maximum length of an environment variable. That's how I know about the problem! :-) You know that old saw - "It hurts when I do that!" - resp. "Then don't do that!"...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.