Is there something that I can type or a set of shortcut keys I can press to produce a shell the login prompt when I first boot up my Linux distro?
Printable View
Is there something that I can type or a set of shortcut keys I can press to produce a shell the login prompt when I first boot up my Linux distro?
Hmm...not sure what distro you're running, and whether you want to actually only boot up into a console, or if you want to leave X running. If you only want to use Linux from the command line, change the default run level in /etc/inittab (assuming you're still on a SysV init based system) to something like:
That starts up your system in run level 3, which is full multi-user mode without X.Code:id:3:initdefault:
If you want to leave X running, but get to a text-based login prompt, I think you can use Ctrl+Alt+1 through Ctrl+Alt+6, and have 6 different simultaneous console sessions. I think Ctrl+Alt+7 gets you back to X.
I could be way off on the key combinations though. It's been a while since I've messed with any of that, I just use run level 3 and do everything via putty sessions from my windows box.
No you misunderstood me. Let's say my computer is off and I boot my it up. It goes thru the whole process and comes to a stop at the password login screen. It will display your name and have a blank password box. At this point I'm looking to get a shell, not a whole x11 window, just plain terminal. Preferably root. I want to feed the system commands like Linux 1 or init=/bin/bash rw or echo "ankit::0:0:::" >> /etc/passwd
I'm trying to gain root acres from the password login screen.
If I don't already have it. But i have googled this extensively and have came up with one solution; exploiting LiLo. I would like to find an alternative
It sounds like you're trying to get into single-user mode, but all the commands you listed don't require single user mode. You can happily do all that in multi-user mode as the root user. Perhaps you can explain why you want, or think you want single-user mode.
Run level 3 will give you a text based login, like you're asking. Just modify inittab as I suggested in the first place (you will have to first login to X and use an xterm to do this). When you reboot, the computer should give you a console (text-based) login. If you have root permission on the computer in question, then you log in with a username of "root" and the root password you specified. If you don't have root, then there's nothing you can do.
Sounds like you installed Ubuntu when you should have installed Slackware.
Quzah.
Basically what I am trying to do is produce a root shell at the login prompt. It's for a piece of mind so one day if my girl or a friend wants to be an dick and change the password, then I can circumvent that issue. I don't know why it's so hard to get an answer related to my question.
Maybe single user mode by typing Linux single at the LILO screen?
So you want to bypass all of your built in security and open a root bash prompt at your login screen?
What a great idea!
Why don't you just buy a thumb drive and set it up so you can boot off of it and mount your hard drives under it?
Quzah.
I read that a lot of distros have that exploit patched. And I didn't want to do that. Basically if let's say my brother runs ubuntu and went to the bathroom but logs off and in order to login back in you need his password. Instead of rebooting can you type something or hit a combo of keys to get a shell To circumvent the password login
Quazah, cuz I don't want to. Or I wouldn't be here asking this question. I would still have to restart it. I will say again, I want a shell at the password prompt! Why is that so hard to understand?
While this is a general forum for general crap, you would be better served on the forums of whatever distro you have instead of a programming forum.
Quzah.
This went great!
Your question seems to be, how can I reset the root password if somebody changes it.
You can't do anything from the boot drive to allow you to do this -- even if you boot to single user you still need a root password to log in. The answer is a boot disk. You boot from a recovery filesystem, then just directly access the /etc/passwd file on the messed up host and blank out the password field. Then reboot normally into single user, set the password. Problem solved.
This doesn't involve any "hacking." The only way someone could actually lock you out is by encrypting the whole filesystem. Of course, it goes both ways. Anybody with physical access to your box can use this trick to reset your passwords as well.
If you have friends who would do crap like that to you, I suggest finding better friends. Also, why do they have root in the first place?
Good question. Furthermore, if your answer is "because I forgot to log out", then the next question is: why are you using the root account when you don't need to?Quote:
Originally Posted by brewbuck
@Anonymous: I really wasn't totally clear on what you wanted until post #8 (which I just now saw since I left work before you posted it). I think a lot of our confusion came from not understanding what exactly you wanted to do and perhaps more importantly, why. You're asking for what amounts to a very insecure and unorthodox solution to a simple problem -- a problem that has a much better solution than the one you want. To be a little blunt, you sound like you don't know Linux that well, and are looking for workarounds to your lack of administration skills. Everybody was a noob at some point, but it's important that you learn the right way to deal with these issues. Way back in the day (during the 2.0 kernel era), I learned quite a bit from O'Reilly's "Linux in a Nutshell" and "Linux System Administration". No idea how good the new editions are. They might help you out a great deal, or maybe somebody can recommend some other books or free online resources.
Basically you want to leave a root session open and logged on at all times. What's to stop your brother/girlfriend/friends from getting root access and disabling your "fail-safe"? And apart from the very obvious security issues there, you generally should not be logged in as root unless absolutely necessary. The root account should only be used for serious systems administration work, like installing new services, adding users, etc, when you need to perform numerous commands that require root privelages. If it's your system, only you should have the root password, nobody else. And if you need to do a quick task that requires root, like "yum install" or "apt-get install", set your regular user up in the sudoers file (man 5 sudoers), so you just type "sudo yum install".
Linux in runlevels 2, 3 and 5 (the "normal" ones) is a multi-user system. That means your brother, friends and girlfriend can all be logged on at the same time. If they are regular users of your system, give them a regular (non-root) user. You can just type "useradd my_ahole_brother_who_changes_my_root_password" and "useradd my_untrustworthy_girlfriend", and they'll have regular user accounts. You can also use whatever GUI version of this utility you may have. They will be able to browse the web or check their email, play games and maybe even do some programming, but they wont be able to change your root password. If you have friends who don't need to use your system regularly, maybe set up a guest account.