Set password for root on virtualbox ubuntu

85

Ubuntu uses sudo by default. If you preface your command with "sudo" it prompts for your user password and then runs it as root. To get a root session use:

sudo -i

To enable the root account, open a terminal and run the following to set a root password:

sudo passwd root

For more information see:

https://help.ubuntu.com/community/RootSudo

Share:
85

Related videos on Youtube

sanitycheck
Author by

sanitycheck

Updated on September 17, 2022

Comments

  • sanitycheck
    sanitycheck over 1 year

    I tried another way to do this, but it ended up crashing my server by using up all the memory.

    My server admins came up with a second approach:

    RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6-$7 [E=underscores:Yes]
    RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6 [E=underscores:Yes]
    RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=underscores:Yes]
    RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=underscores:Yes]
    RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=underscores:Yes]
    RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=underscores:Yes]    
    RewriteCond %{ENV:underscores} ^Yes$
    RewriteRule (.*) http://www.mydomain.tld/$1 [R=301,L] 
    

    This approach seems more stable and doesn't use up memory.

    The only problem is that this approach affects all files on the server, not just files that start with the word "article", such as http://www.mydomain.tld/article...

    That doesn't work because this is a WordPress installation, and it tries to change all WordPress theme files that use underscores, rendering significant parts of the website unusable.

    Can anyone suggest a way to modify this code to make it only apply when the word "article" is involved file name part of the URL?

    • Admin
      Admin over 13 years
      Off-topic, but try sudo su.
    • Panama Jack
      Panama Jack about 10 years
      You keep asking the same question and they are answered. I don't believe the rewrites are causing the memory issue. There is something else going on in connection with your wordpress site. There are plenty of servers that use such a rewrite and don't have that problem. The earlier answer was also fine. All your sys admin did was give you another code to try from here askapache.com/htaccess/rewrite-underscores-hyphens-seo-url.h‌​tml. You need to have them find the real reason. There are at least 3 other SO questions with similar rewrites and no memory issues.
  • Asher Bitton
    Asher Bitton over 13 years
    Just to extend slightly (and summarise the link above), by default you cannot log in as root in Ubuntu, but it is possible to set a root password but is not recommended (or actively discouraged)
  • Wesley Rice
    Wesley Rice over 13 years
    'rescue mode' is for disaster recovery, not adding users to the admin group. A 'visudo' command or 'sudo vi /etc/sudoers' should be sufficient.
  • dsas
    dsas over 13 years
    The problem is that the OP doesn't have sudo access, he cannot fix that by running visudo or sudo vi /etc/sudoers as they both require that he has sudo access.
  • Wesley Rice
    Wesley Rice over 13 years
    No, the problem is that OP doesn't know the root password- "it asks for root password and I don't know it!", to quote. Booting into rescue mode won't get him anywhere.
  • dsas
    dsas over 13 years
    There generally isn't a root password on Ubuntu. The OP has clarified that the user accounts he does have access to don't have sudo access. Booting in rescue mode as far as I remember gives the option to start a shell as root where he can reset the root password or give sudo access to one of the other user accounts.
  • Wesley Rice
    Wesley Rice over 13 years
    Oh, in that case you're talking about single-user mode, which isn't the same as 'rescue mode', where you typically perform rescue operations.
  • dsas
    dsas over 13 years
    Yes, which is accessed by selecting "recovery" mode in grub.
  • Panama Jack
    Panama Jack about 10 years
    He's probably still going to have issues with OOMing because the answer he asked before worked just fine as well. I suspect other problems.
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    (1) sudo asks for the user's password. What is "osboxes.org"? (2) The user doesn't have sudo access, so this will just result in an error message.
  • Syaiful Nizam Yahya
    Syaiful Nizam Yahya over 5 years
  • Syaiful Nizam Yahya
    Syaiful Nizam Yahya over 5 years
    For some weird reason, the only way to become root in osboxes.org is the way that I mentioned. If its wrong, prove it.
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    OK, so they provide pre-made VMs for people who don't want to go through the hassle of installing them properly.  This information, if correct, may be valuable.  But somebody else agrees with me that it's not an answer to this question.  I suggest that you ask a new question about OSBoxes and post your answer there.  I'm not going to download software from a site of unknown trustworthiness, but I expect that dsas's answer regarding "rescue mode" / "single-user mode" will work on an OSBoxes VM.
  • Čamo
    Čamo almost 4 years
    sudo is fine, but if I want to run some cron jobs which cant require password I need to run it as root. So I dont understand this Ubuntu policy about root.
  • dsas
    dsas over 3 years
    You should add a separate question for that really, but that can be achieved by editing roots crontab using sudo crontab -e