Beaglebone Sudoers File get Corrupted.

41 views
Skip to first unread message

sayalik...@gmail.com

unread,
Mar 19, 2019, 7:42:33 AM3/19/19
to BeagleBoard
Hi, 
  I did a some change in sudoers file, so i can not be root , i can not use sudo or su 
debian@beaglebone: sudo su -
sudo: >>> /etc/sudoers: syntax error near line 23 <<<
sudo: parse error in /etc/sudoers near line 23
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

How can I correct this file ?
Thank You

Jim F

unread,
Mar 19, 2019, 10:36:31 AM3/19/19
to beagl...@googlegroups.com
Do you have the root password? If so you can su and then fix it. If not you should look up how to break in to a Linux system, which is usually a mod to the boot command. Search for single user mode. Probably you'll need a serial to USB cable for your board. If you messed up the image on the mmc instead you can boot off an SD card and then chroot to the emmc image and reset the root pass. 

Next time you edit your sudoers file use the command visudo which will check that the file is valid prior to saving. 

Jim

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/88e3e3b5-2619-4c3c-865a-30179b1ab62f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dennis Lee Bieber

unread,
Mar 19, 2019, 11:25:51 AM3/19/19
to beagl...@googlegroups.com
On Tue, 19 Mar 2019 03:56:36 -0700 (PDT),
sayalik...@gmail.com declaimed the
following:
If that is in the eMMC, boot with a fresh SD card image.
If that is in an SD card, remove it and boot from the eMMC image

THEN
Mount the other device (insert the SD card if booting from eMMC)
somewhere into the file system...
Copy the good /etc/sudoers file from the booted system to
/whereever/mounted/etc/sudoers...

Dismount, reboot

And, as mentioned elsewhere, only use "visudo" to edit the sudoers
file; do not edit it by hand using any other command.


--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/

Dan Sloane

unread,
Apr 10, 2019, 7:25:25 AM4/10/19
to BeagleBoard
Hi - do you think this process would work for recovering /etc/passwd when, despite typing it three times (change, confirm, into notes),  my new debian user password isn't accepted. 

Single user mode on BBB seems non-trivial and I'd rather not start again with my config. 

Thanks,
Dan

Jim F

unread,
Apr 10, 2019, 7:54:52 AM4/10/19
to beagl...@googlegroups.com
Yes, same concept. Once you have the system booted, set your password then copy the /etc/passwd file over to the other partition. I forget if the default BB image uses shadow password file so if there's no password data in the passwd file you might need to copy over the /etc/shadow file too. Make sure to preserve the user and group ownership and permissions too. 

J

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Dennis Lee Bieber

unread,
Apr 10, 2019, 12:38:55 PM4/10/19
to beagl...@googlegroups.com
On Wed, 10 Apr 2019 03:53:49 -0700 (PDT), Dan Sloane
<d...@sloane-squared.com> declaimed the
following:

>Hi - do you think this process would work for recovering /etc/passwd when,

Passwords may not even be /in/ /etc/passwd -- I know Mandrake
(Mandriva/Mageia) implemented a shadow password system 15-20 years ago.
Reason: /etc/password is pretty much globally readable, and even with a
one-way hash for passwords, being able to read the hashed password makes it
simpler to hack the accounts on a machine (generate random passwords using
the account's seed value until the hash matches).

The shadow file is in protected directory and only readable by the
login/security functions.

Dan Sloane

unread,
Apr 10, 2019, 12:52:04 PM4/10/19
to beagl...@googlegroups.com
Thanks both.  

Looks like the shadow file was updated around the correct time last night.    Moral of the story: don't update passwords at close to 1am. 

debian@beaglebone:/etc$ ls -l pass* shadow*
-rw-r--r-- 1 root root   1611 Feb  7 23:56 passwd
-rw------- 1 root root   1611 Feb  7 23:56 passwd-
-rw-r----- 1 root shadow 1045 Apr 10 00:49 shadow
-rw------- 1 root root    960 Feb  7 23:56 shadow-


Dan




--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/xC0yN1mHalo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/eo6sael22o3inmvead2hgecplv4fnohl6t%404ax.com.

For more options, visit https://groups.google.com/d/optout.


--
Dan Sloane

Sloane Squared Ltd
Technology for Events, Exhibitions and Visitor Experiences


Sloane Squared Ltd is registered in England and Wales, number 7646371. VAT registration number 116 8861 93. Registered address: Cardinal House,46 St Nicholas Street, Ipswich, Suffolk, IP1 1TT
Reply all
Reply to author
Forward
0 new messages