0

I have installed this version of Ubuntu on my laptop.

└─ $ ▶ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:    16.04
Codename:   xenial

Because of my limited knowledge regarding Linux, I have added a line manually to /etc/passwd My user which I login to the laptop is gofoboso with a password. This user has sudo rights. After adding the second line into the contents following, I do not have sudo rights.

root:x:0:0:root:/root:/usr/bin/zsh
gofoboso:x:0:0:gofoboso:/gofoboso:/usr/bin/zsh
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin

I understand that the passwords are encrypted on the /etc/shadow file, and now this has the exact attributes as the root user has (??)

   ─ $ ▶ sudo cat /etc/shadow
    [sudo] password for gofoboso: 
    Sorry, try again.
    [sudo] password for gofoboso: 
    sudo: account validation failure, is your account locked

This is the company's laptop and I do not have the root password. I've tried some commands I found online but all of them required sudo. Anyone knows how can I revert this ? Most importantly I cannot restart the laptop or shut it down, because it will ask the password of the user gofoboso, which probably it's the same as root's now ?? If it cannot be fixed without becoming root, If someone knows the root password, and deletes that line the gofoboso user will be enabled again?

Thanks.

3
  • Your new user has some UID but not same name as root, so it will have same rights, basically super administrator of the laptop, no need of sudo anymore. You previously add sudo rights to edit /etc/passwd but you do not have root password? Strange setup as you have the same rights. Next time use adduser or useradd, depending on distribution, to create new accounts. It is almost always a bad idea to edit /etc/passwd and/or /etc/shadow directly by hand. Feb 2 '18 at 22:59
  • BTW, when you are issuing the sudo command, and it asks for the password; it is not asking for the root password, it is asking for the sudoer password. Just to be clear.
    – Shōgun8
    Feb 2 '18 at 23:03
  • Yes, Octavian I enter my password, which was working before the change I did on the /etc/passwd file, but it's obviously not working anymore.
    – g0f0b0s0
    Feb 3 '18 at 21:10
0

You'll need to get into 'single user mode'. You can eithe issue the command 'init 1', or reboot it and gain single user access by modifiying the grub entry; (you'll have to add the word 'siingle' as the last word on the kernel line).

7
  • Thanks, but can you please elaborate a bit more ?
    – g0f0b0s0
    Feb 2 '18 at 22:28
  • I've searched the single user mode, I understand if you get into the recovery mode, you choose the root shell prompt. Will I get asked the root password for the last one ?
    – g0f0b0s0
    Feb 2 '18 at 22:36
  • Good question. you might. If so then try adding "rw init=/bin/bash" to the kernel line
    – Shōgun8
    Feb 2 '18 at 22:52
  • As long as they haven't disabled single user mode form the grub menu, you should be fine. Please refer to this: fedoraproject.org/wiki/How_to_reset_a_root_password
    – Shōgun8
    Feb 2 '18 at 22:55
  • Which is the kernel file you 're referring to ? How do I access it, and does it need sudo rights ?
    – g0f0b0s0
    Feb 3 '18 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.