So say you out init 0 in your bashrc

cluelessstudent

New Member
Joined
Aug 21, 2020
Messages
1
Reaction score
0
Credits
13
I'm currently in a class, and we are working on linux troubleshooting. On CentOS 6, the only local user is root, all other users are network users. Our most recent bug, is init 0 in root's bashrc. I know that this can be fixed via ssh, however, the instructor said that there are three ways to fix it. I'm curious if anyone else knows of a way to go about fixing this.
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,527
Credits
35,667
It's not a bug it works as intended, this file used to set bash settings and such and it executed when the user logs into the system. Why would you even want to put init 0 in the root bashrc, what's the point? You can't fix this through ssh or through the console because every time you try to login the system is shutdown because init 0 gets executed. The only way to fix this it to boot from the cd into rescue mode, to then undo the line in root bashrc, and then to reboot into a normal running environment again.
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,472
Reaction score
1,074
Credits
9,160
There is another way, assuming someone besides root has full sudo privileges.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,900
Reaction score
3,527
Credits
35,667
There is another way, assuming someone besides root has full sudo privileges.
I was going by that the OP said that the only user on the system is root and the only other users available are system users. Agreed with you on that point if there are other normal users on the system available that have full sudo privileges.
 

Drizzit89

Member
Joined
May 17, 2019
Messages
55
Reaction score
33
Credits
31
Remote fix: You could replace the file by pushing an overwrite the file using secure copy. bashrc shouldn't be invoked since it wouldn't be an interactive shell on the target system.
Local fix: Another would be to change the file from a shell invoked from the bootloader, if available, like in debian or unix systems. This root user is not associated with the OS but can mount the file system and has permissions to make changes files and file system. I have used the second method to recover root without sudo users available on debian and on unix systems without a user with enough permissions to change the root user's password.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top