Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
I forgot my root password
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
marsmar
n00b
n00b


Joined: 08 Apr 2018
Posts: 16

PostPosted: Fri Nov 09, 2018 11:49 am    Post subject: I forgot my root password Reply with quote

I have did install gentoo half year ago. Now I forgot root password. How to change root password in gentoo while don't have permission ?
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21795
Location: here

PostPosted: Fri Nov 09, 2018 11:59 am    Post subject: Re: I forgot my root password Reply with quote

marsmar wrote:
I have did install gentoo half year ago. Now I forgot root password. How to change root password in gentoo while don't have permission ?

You can boot from a livecd follow step for make chroot and then you can use passwd, umount partition and reboot.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
marsmar
n00b
n00b


Joined: 08 Apr 2018
Posts: 16

PostPosted: Fri Nov 09, 2018 12:49 pm    Post subject: Re: I forgot my root password Reply with quote

fedeliallalinea wrote:
marsmar wrote:
I have did install gentoo half year ago. Now I forgot root password. How to change root password in gentoo while don't have permission ?

You can boot from a livecd follow step for make chroot and then you can use passwd, umount partition and reboot.


Start LiveCD, and open console. Then mount /dev/** to /mnt/gentoo1 --> chroot /mnt/gentoo1 --> passwd root - this change root (/dev/**) password --> exit --> umount /mnt/gentoo1 --> reboot . Is taht how should do ?
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21795
Location: here

PostPosted: Fri Nov 09, 2018 1:08 pm    Post subject: Re: I forgot my root password Reply with quote

marsmar wrote:
Start LiveCD, and open console. Then mount /dev/** to /mnt/gentoo1 --> chroot /mnt/gentoo1 --> passwd root - this change root (/dev/**) password --> exit --> umount /mnt/gentoo1 --> reboot . Is taht how should do ?

Yes
Code:
# mount /dev/<root_partition> /mnt/gentoo
# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# passwd

_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 102

PostPosted: Fri Nov 09, 2018 1:32 pm    Post subject: Reply with quote

another approach (no need livecd):
When bootloader menu appeared press "e" key and you will get into menu edit mode. Append "single" (without quotations) parameter to kernel command line (the line which starts with "linux" word), and boot by pressing F10 key. When you will be asked for root password, just press Ctrl+D or Enter key. Then type this command:
Code:
mount -o remount,rw /

and then type
Quote:
passwd
command.
Back to top
View user's profile Send private message
marsmar
n00b
n00b


Joined: 08 Apr 2018
Posts: 16

PostPosted: Fri Nov 09, 2018 1:53 pm    Post subject: Re: I forgot my root password Reply with quote

fedeliallalinea wrote:
marsmar wrote:
Start LiveCD, and open console. Then mount /dev/** to /mnt/gentoo1 --> chroot /mnt/gentoo1 --> passwd root - this change root (/dev/**) password --> exit --> umount /mnt/gentoo1 --> reboot . Is taht how should do ?

Yes
Code:
# mount /dev/<root_partition> /mnt/gentoo
# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# passwd


What "source /etc/profile" do ?
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21795
Location: here

PostPosted: Fri Nov 09, 2018 1:57 pm    Post subject: Reply with quote

It's for set some bash env variables probably is not needed in your case, I just copy&paste command from gentoo handbook.
I think that Blind_Sniper approach is more simple
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Blind_Sniper
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2018
Posts: 102

PostPosted: Fri Nov 09, 2018 1:59 pm    Post subject: Reply with quote

Code:
source /etc/profile

sets some profile environment and path variables.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2273
Location: Bardowick, Germany

PostPosted: Sat Nov 10, 2018 2:49 pm    Post subject: Reply with quote

Why did nobody mention to simply become root with your user password using "sudo su -"?
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5630
Location: Removed by Neddy

PostPosted: Sat Nov 10, 2018 3:01 pm    Post subject: Reply with quote

Yamakuzure wrote:
Why did nobody mention to simply become root with your user password using "sudo su -"?

Code:
sudo su -
-bash: sudo: command not found


because not everyone makes use of sudo :wink:

The few times I have done this I personally prefer appending init=bash to grub and then mount -o remount,rw /
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13867

PostPosted: Sat Nov 10, 2018 4:35 pm    Post subject: Reply with quote

Yamakuzure wrote:
Why did nobody mention to simply become root with your user password using "sudo su -"?
Because that is the wrong way to use sudo. If you want an interactive shell, use sudo -i. It's shorter and clearer what you want.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7094
Location: Saint Amant, Acadiana

PostPosted: Sat Nov 10, 2018 5:23 pm    Post subject: Reply with quote

Slight correction, sudo -s for shell. ;) And sudo -i for shell with environment, practically login.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 152

PostPosted: Sun Nov 11, 2018 7:25 pm    Post subject: Reply with quote

Jaglover wrote:
Slight correction, sudo -s for shell. ;) And sudo -i for shell with environment, practically login.

What's the difference between those two? I thought they were one and the same... :oops:
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

===
I refuse to move on from GTK+2.
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2576

PostPosted: Mon Nov 12, 2018 12:31 am    Post subject: Reply with quote

ummm... would not the simple solution be just sudo passwd?
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Muso
l33t
l33t


Joined: 22 Oct 2002
Posts: 981
Location: The Holy city of Honolulu

PostPosted: Mon Nov 12, 2018 4:16 am    Post subject: Reply with quote

Naib wrote:
because not everyone makes use of sudo :wink:


++

So much this. I've never cared for sudo. If someone isn't trusted with root, why give them sudo?
_________________
Time is a great teacher, but unfortunately it kills all its pupils.
Back to top
View user's profile Send private message
Cuong Nguyen
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jan 2018
Posts: 130

PostPosted: Mon Nov 12, 2018 4:45 am    Post subject: Reply with quote

Muso wrote:
Naib wrote:
because not everyone makes use of sudo :wink:


So much this. I've never cared for sudo. If someone isn't trusted with root, why give them sudo?


Just like running Windows with full Administrator rights? Who don't? But Windows uses User Access Control that pops up Warnings or asking for permission for individual tasks. You can also lower level of UAC.

I am not sure if in Linux is there the same features as Windows UAC. I always set "myid as ALL=(ALL) NOPASSWD:ALL" for my non-root account. (Not a good practice though :) )
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13867

PostPosted: Mon Nov 12, 2018 5:33 am    Post subject: Reply with quote

Muso wrote:
If someone isn't trusted with root, why give them sudo?
With the right configuration, you can give someone limited sudo, such as the ability to reset a particular service. This can be useful if you trust the user a little bit, but would prefer not to give them unrestricted root.
Back to top
View user's profile Send private message
Muso
l33t
l33t


Joined: 22 Oct 2002
Posts: 981
Location: The Holy city of Honolulu

PostPosted: Mon Nov 12, 2018 5:38 am    Post subject: Reply with quote

Hu wrote:
Muso wrote:
If someone isn't trusted with root, why give them sudo?
With the right configuration, you can give someone limited sudo, such as the ability to reset a particular service. This can be useful if you trust the user a little bit, but would prefer not to give them unrestricted root.


Makes sense. But for any home users, sudo just seems pointless.
_________________
Time is a great teacher, but unfortunately it kills all its pupils.
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2576

PostPosted: Mon Nov 12, 2018 6:13 am    Post subject: Reply with quote

Muso wrote:
Hu wrote:
Muso wrote:
...


Makes sense. But for any home users, sudo just seems pointless.
Actually very useful. If you are not running a full desktop environment (or refuse to use *kits, etc.) using suspend/shutdown commands requires the user to have root access. A clean way to do it is to use a script that employs sudo to give them that level of access. That script can then be called from the environment giving a clean feeling as well as a functional one.

If you have kids and/or other parties tempted to tinker with your computer that allows them full use but not full access.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2512
Location: Canada

PostPosted: Mon Nov 12, 2018 6:35 am    Post subject: Reply with quote

Muso wrote:
Hu wrote:
Muso wrote:
If someone isn't trusted with root, why give them sudo?
With the right configuration, you can give someone limited sudo, such as the ability to reset a particular service. This can be useful if you trust the user a little bit, but would prefer not to give them unrestricted root.


Makes sense. But for any home users, sudo just seems pointless.



One variation on the usefulness of sudo, is that using root account, I tend to leave somewhere terminals with root logged in :) (which shows, that I do not use sudo ...)
I suspect if anybody gets to my office machine right now while I am away, he has a fair chance to find root logged in somewhere .....
Back to top
View user's profile Send private message
Muso
l33t
l33t


Joined: 22 Oct 2002
Posts: 981
Location: The Holy city of Honolulu

PostPosted: Mon Nov 12, 2018 6:35 am    Post subject: Reply with quote

The Doctor wrote:
Muso wrote:
Hu wrote:
Muso wrote:
...


Makes sense. But for any home users, sudo just seems pointless.
Actually very useful. If you are not running a full desktop environment (or refuse to use *kits, etc.) using suspend/shutdown commands requires the user to have root access. A clean way to do it is to use a script that employs sudo to give them that level of access. That script can then be called from the environment giving a clean feeling as well as a functional one.

If you have kids and/or other parties tempted to tinker with your computer that allows them full use but not full access.


Maybe I'm just old, but I just su for that.
_________________
Time is a great teacher, but unfortunately it kills all its pupils.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2273
Location: Bardowick, Germany

PostPosted: Mon Nov 12, 2018 3:33 pm    Post subject: Reply with quote

Naib wrote:
Yamakuzure wrote:
Why did nobody mention to simply become root with your user password using "sudo su -"?

Code:
sudo su -
-bash: sudo: command not found


because not everyone makes use of sudo :wink:
So nobody up to that point answering has sudo installed? Wow. Didn't expect this.

Hu wrote:
Because that is the wrong way to use sudo. If you want an interactive shell, use sudo -i. It's shorter and clearer what you want.
What makes it wrong?

Actually it works, so it isn't "wrong" in the meaning of "Not working like that".

But "sudo -s" ich much nicer! Thanks for the hint! :D
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13867

PostPosted: Tue Nov 13, 2018 2:17 am    Post subject: Reply with quote

Yamakuzure wrote:
So nobody up to that point answering has sudo installed? Wow. Didn't expect this.
Not necessarily. Some sudo users don't evangelize the use of sudo quite so eagerly. It could be that earlier respondents use sudo, but didn't want to recommend it as the best solution for the perceived problem.
Back to top
View user's profile Send private message
Yamakuzure
Advocate
Advocate


Joined: 21 Jun 2006
Posts: 2273
Location: Bardowick, Germany

PostPosted: Tue Nov 13, 2018 9:56 am    Post subject: Reply with quote

Hu wrote:
Yamakuzure wrote:
So nobody up to that point answering has sudo installed? Wow. Didn't expect this.
Not necessarily. Some sudo users don't evangelize the use of sudo quite so eagerly. It could be that earlier respondents use sudo, but didn't want to recommend it as the best solution for the perceived problem.
I believe that. It took years for me to not going "su" everytime and actually do use "sudo".
My sudoers file is quite strict, but it allows me to do the most common tasks without the need to enter my root password.
_________________
Important German:
  1. "Aha" - German reaction to pretend that you are really interested while giving no f*ck.
  2. "Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.
Back to top
View user's profile Send private message
marsmar
n00b
n00b


Joined: 08 Apr 2018
Posts: 16

PostPosted: Tue Nov 13, 2018 10:32 am    Post subject: Reply with quote

Blind_Sniper wrote:
another approach (no need livecd):
When bootloader menu appeared press "e" key and you will get into menu edit mode. Append "single" (without quotations) parameter to kernel command line (the line which starts with "linux" word), and boot by pressing F10 key. When you will be asked for root password, just press Ctrl+D or Enter key. Then type this command:
Code:
mount -o remount,rw /

and then type
Quote:
passwd
command.


When I add "single" to grub command nothing happens, system starts as usually. There is no Ctrl-D message
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum