What is the default root password?
I installed Ubuntu 12.04 LTS (Precise Pangolin), 64 bit. Nowhere was I asked to set password for root. I just installed AccuRev SCM software. It was installed under the /root folder by default. Now I try do something on that folder. I tried with su to switch to root, but I don’t know its password. Should I always use sudo or get the default root password, if any? How do I create a launcher for software installed inside the /root directory?
this lameass website won’t let me answer, but the correct answer is: sudo usermod root -p password; sudo passwd root; then enter the new password. presto, root is unlocked and you can now su/login with root
How idiotic things can get — su is disabled, sudo is not installed, this distribution is used as a base for mssql server, the instructions say you need to sudo open some network ports to enable MSDTC. Back to square 1.
4 Answers 4
By default, the root account is accessed by sudo.
For a complete discussion in the topic, and information for how to set a root password, see: RootSudo — Community Ubuntu Documentation
With that said, it is extremely unlikely you need to set a root password, I advise you use
Or for graphical applications, use gksu
«extremely unlikely you need to set a root password»: I do not agree. If one is logged in as «joeblo», and then needs to move their /home/joeblo directory aside to move in a new one from a previous installation. They cannot do that safely from their own user account. They must do that from some other user account. Yes, they could sudo and then create a second user account, and then sudo and do the move, but that is a waste of effort. This happens to me every time I load a new version of Linux since I want to replace the installer-generated /home/joeblo directory with my previous one.
Bodhi.zazen has by far the best answer; boot to recovery mode (wiki.ubuntu.com/RecoveryMode). If you have a corrupted groups file and can’t sudo (sometimes there is no substitute for being root).
at lindhe — askubuntu.com/questions/11825/… . In addition gksu is in theory better for integrating and security with graphical applications and sudo / su are intended for command line interface (IMHO).
Password for root is not set in Ubuntu which means the root login is disabled by default.
The user account created during Ubuntu installation is associated with all sudo capabilities. You could use sudo for commands that require root privileges in Ubuntu terminal.
However you can enable the root account and set a password for it. To do so use:
Firstly you will be asked for your current user password and after this you will be asked for the new password twice (new and retype password) as your new root password.
I couldn’t remember ever setting up my root password so I couldn’t remember it and $ su root was failing with every password I tried. I ran your command $ sudo passwd root and it worked perfectly. Thanks for a great answer.
You should still configure the root password for Ubuntu. Since it’s disabled by default and you create a user password for all admin tasks on installation, booting into single user mode will give access to a root shell — even if your boot options have been set to prompt for one. It doesn’t have one to ask for unless you set it
sudo has benefits, but not having a root password set can also be troublesome. I had a machine last week that failed to boot up, showing the message «Give root password for maintenance (or press Control-D to continue):» The problem is that the machine did not have a root password set, and just pressing enter would only display the message again, as would control-D, so I had to take the hard drive out and access it from another machine to fix it.
By default the Ubuntu installer does not set up a root password and therefore you don’t get the ability to log in as root. Instead you are given the ability to perform tasks with superuser privileges using sudo.
While you can create a password for the root account allowing you to log in as root with su , there are some distinct benefits to using sudo.
Sudo is an alternative to giving people a root password in order to perform superuser duties. In a default Ubuntu install the person who installed the OS is given «sudo» permission by default.
Anybody with «sudo» permission may perform something «as a superuser» by pre-pending sudo to their command. For instance, to run apt-get dist-upgrade as a superuser, you could use:
By default, sudo will ask you for your own account password when performing this. This helps security. This is remembered for a few minutes so if you have a few tasks to do with sudo it will only ask you for your password on the first.
You will see the above usage of sudo pretty much anywhere you read a tutorial about Ubuntu on the web. It’s an alternative to doing this.
su apt-get dist-upgrade exit
With sudo, you choose in advance which users have sudo access. There is no need for them to remember a root password, as they use their own password. If you have multiple users, you can revoke one’s superuser access just by removing their sudo permission, without needing to change the root password and notify everyone of a new password. You can even choose which commands a user is allowed to perform using sudo and which commands are forbidden for that user. And lastly, if there is a security breach it can in some cases leave a better audit trail showing which user account was compromised.
Not having a root password makes brute force attacks on the root account impossible: this is relevant if you allow login over SSH. Instead, an attacker would need to know a local account name.
Sudo makes it easier to perform a single command with superuser privileges. With su , you permanently drop to a superuser shell which must be exited using exit or logout . This can lead to people staying in the superuser shell for longer than necessary just because it’s more convenient than logging out and in again later.
Getting a root shell
With sudo, you still have the option of opening a permanent (interactive) superuser shell with the command:
. and this can still be done without any root password, because sudo gives superuser privileges to the su command.
And similarly, instead of su — for a login shell you can use sudo su — or even sudo -i .
However when doing so you just need to be aware that you are acting as a superuser for every command. It’s a good security principle not to stay as a superuser for longer than necessary, just to lessen the possibility of accidentally causing some damage to the system (without it, you can only damage files your user owns).
Just to clarify, you can, if you choose, give the root user a password allowing logins as root, if you specifically want to do things this way instead. I just wanted to let you know about the Ubuntu convention of preferring sudo instead and let you know that there is an alternative.
Устанавливаем/сбрасываем ROOT пароль
Этот способ предполагает вход в систему Ubuntu под пользователем с sudo правами, а команда «su» разрешена как часть «sudo» привилегий.
Вводим следующую команду, чтобы войти в систему с root-правами:
При появлении запроса «[sudo] password for *user*» вводим свой пароль, чтобы продолжить.
Глядя на скриншот выше, можно заметить смену пользователя на «root», таким образом, мы вошли в Ubuntu под root, используя свой пароль.
Теперь мы можем сменить пароль root-пользователя, для этого необходимо использовать следующую команду:
После ввода команды указываем новый пароль в запросе «New password» и повторяем новый пароль после запроса «Retype new password».
Пароль для root будет установлен при первом использовании команды или изменит его на новый пароль при дальнейших использованиях команды «passwd».
А работает ли новый пароль? Давайте это выясним, нажимаем сочетание клавиш «Ctrl+D», чтобы окончить текущий ввод данных в терминале, либо запускаем новый терминал и вводим новую команду:
Данной командой мы войдем в систему как root, после чего вводим новый пароль, который мы только что установили для root.
Таким образом мы успешно изменили пароль от root.
Сбрасываем пароль от root через GRUB
Существует еще один способ для изменения пароля от root или любого другого пользователя при загрузке Ubuntu.
Сначала перезагружаем наш ПК. Если меню GRUB не появляется автоматически, то удерживаем клавишу «Shift» во время загрузки. Это принудительно откроет меню GRUB.
Затем выбираем пункт «Ubuntu» в меню и нажмите клавишу «E», чтобы начать редактирование конфигурации загрузки.
Далее необходимо внести изменения в строку, заменяем значение:
Результат отображен на скриншоте ниже:
Изменения заключаются в том, чтобы из GUI перейти в оболочку Bash для внесения изменений — смена пароля. Нажимаем клавишу «F10», чтобы загрузиться с новой конфигурацией.
Загрузка с измененной конфигурацией сработает только один раз и сброситься при повторной загрузке.
Мы вошли в систему как root-пользователь в командной строке. Теперь используем команду для сброса пароля:
Указываем и повторяем новый пароль.
Затем перезагружаем систему в обычном режиме (без GRUB) и входим как root уже с новым паролем.
How to Change Root Password in Ubuntu Linux
In this tutorial, we will show you how to switch to the root user account and set the root password on Ubuntu systems.
Introduction
On all Linux and Unix-like systems, the root user (or superuser) is a special user account. It has complete and unrestricted access to all commands and resources on the system.
If you’re switching from another Linux distribution to Ubuntu, you might be wondering what the default root password is and how to change it. The root user account is deactivated by default in Ubuntu for security concerns.
In this tutorial, we will show you how to switch to the root user account and set the root password on Ubuntu systems.
Temporary Switching to root
Granting sudo capabilities to regular users encourage Ubuntu users to do system administration duties. Authorized users can run programs as another account, usually, the root user, using sudo .
The sudo group is already a member of the account established by the Ubuntu installer. It’s likely that the user you’re now logged in as has administrative access.
Run the following command, prefixed with sudo , to temporarily boost root user privileges:
You’ll be prompted for the user password the first time you use sudo in a session.
You can use the sudo su or sudo -i commands and input the user password to temporarily switch to the root account in the current login session:
To ensure that the user has been changed, use the whoami command:
Changing Root Password
Although the root user has been disabled, this does not imply that the root account has been deleted. Because the root account has no password, logging in as root is not feasible.
If you need to enable the root account for some reason, all you have to do is set a password for the root user. The passwd command in Ubuntu allows you to set or update a user account’s password.
Run the following command as a sudo user to change the root user’s password in Ubuntu:
The new root password will be required to be entered and confirmed.
Make sure you use a strong and unique password when creating the password. The most critical part of your account’s security is having a strong password. A strong password often consists of at least 16 characters, one uppercase letter, one lowercase letter, one number, and one special character.
When you type the password, it does not appear on the screen.
Output Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
That’s it. The password for the root account has been updated.
You can now use the new password to log in to your Ubuntu system as root.
Conclusion
The root account in Ubuntu has no password by default. To run commands with root capabilities, the sudo command is advised.
You’ll need to set the root password before you can log in as root.
If you have any queries, please leave a comment below and we’ll be happy to respond to them.