change root user in ubuntu
- Run
sudo <command>and type in your login password, if prompted, to run only that instance of the command as root. Next time you run another or the same command without thesudoprefix, you will not have root access. - Run
sudo -i. This will give you an interactive root shell. Note that the$at the end of your prompt has changed to a#, indicating that you have root access. From here you can run any sequence of commands as root, or run the commandexitto leave the root shell. - Use the
su(substitute user) command to get a root shell. This is effectively the same as usingsudo -i. Note that when you use this command it will ask for the root password and not your login password. These are not the same. You may have to set or change the root password by runningsudo passwd rootfirst. - Run
sudo -s. This gives you root access, but maintains your current SHELL. Shell specific settings, including your current directory, are preserved. For instance if you usebash(Ubuntu's default shell), aliases (and any other settings from~/.bashrc) are kept when you switch to the root user. - exit root user use in terminal type exit . Or you can simply press CTRL+D.
Comments
Post a Comment