Thread: Shell at login prompt

  1. #1
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302

    Shell at login prompt

    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?

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    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:
    Code:
    id:3:initdefault:
    That starts up your system in run level 3, which is full multi-user mode without X.

    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.

  3. #3
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    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.

  4. #4
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    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

  5. #5
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    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.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Sounds like you installed Ubuntu when you should have installed Slackware.


    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by quzah View Post
    Sounds like you installed Ubuntu when you should have installed Slackware.
    Wow...that may be the first time I actually, actually LOLed from a comment on this forum. Nicely put.

  8. #8
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    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.

  9. #9
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    Maybe single user mode by typing Linux single at the LILO screen?

  10. #10
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    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.
    Hope is the first step on the road to disappointment.

  11. #11
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    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

  12. #12
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    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?

  13. #13
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    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.
    Hope is the first step on the road to disappointment.

  14. #14
    Registered User Annonymous's Avatar
    Join Date
    Apr 2011
    Location
    Jackson, New Jersey, United States
    Posts
    302
    This went great!

  15. #15
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    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?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Own Shell: Displaying prompt and write a command
    By xyphen in forum C Programming
    Replies: 4
    Last Post: 12-08-2009, 04:21 PM
  2. Replies: 8
    Last Post: 12-08-2009, 12:55 PM
  3. Command Prompt Shell
    By FlyingIsFun1217 in forum C++ Programming
    Replies: 20
    Last Post: 09-19-2007, 02:36 PM
  4. Replies: 5
    Last Post: 05-06-2004, 09:14 AM
  5. Automatic Database login prompt
    By Colin in forum C++ Programming
    Replies: 1
    Last Post: 03-14-2003, 08:27 AM