Master login linux ubuntu

toph

Distinguished
Aug 2, 2011
5
0
18,510
Hello,
I have an IBM thinkpad with 2007 install of Linux & Ubuntu, asking for login/password and details given don't work. Is there master user/pass to use to operate the system and recreate user/pass? Not an internet login issue, but laptop sign-in level of it.
 

Djhg2000

Distinguished
May 16, 2009
165
0
18,680
If you have an Ubuntu LiveCD you can do the following to reset your password:

1. Boot from CD
2. Make sure the partition holding the OS is mounted (you can do this by browsing the drive in Gnome which will automatically mount it)
3. Copy the full path to the drive, e.g. /media/Ubuntu or similar
4. Open a terminal and type "sudo chroot " followed my the path you copied earlier
5. If all is successful, "passwd " followed by the name of your user should do the trick
6. Reboot without the CD and login
7. Done
 

toph

Distinguished
Aug 2, 2011
5
0
18,510
 
Everybody's user/password combination will be unique. The only user that you can rely on to exist is "root", but who knows what the password for that is on your system.

If you can't remember what you specified when you installed, the Live CD is the best option.
 

Djhg2000

Distinguished
May 16, 2009
165
0
18,680
 

toph

Distinguished
Aug 2, 2011
5
0
18,510
IN issuing "useradd insert_new_username_here --create-home --user-group" before "passwd insert_new_username_here".... I wonder how to gain access to this explicitly...

The computer boots up to a windows-like logon screen for a username... I have no option to enter command lines there.

When I FIRST turned on the machine a couple weeks ago (after a couple yrs off), it set itself thru an "overdue inspection". This is when it first hit me I was dealing with a Unixy style setup vs. straight Windows.

When I went thru a shutdown routine, it also went into DOS-like script execution mode (automated as a response to my hitting the POWER button to shutdown to get the system off-line fast from a lighnting storm crashing down in my neighborhood).

I'm still awaiting a response from the one person who might best have the login stuff parked in his head otherwise...
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360
Have you already reset the root password via the livecd? If so, from the login screen issue a ctrl+alt+F1 to get to a psuedo terminal, log in as root, and issue the commands (you could just log in at the login screen as root, but I generally avoid runnning a full X session as root)
 
I can't remember offhand, but some distributions don't allow root logons via gdm or respond to the key combination to get a terminal. I think Ubuntu might be one. If so you have to follow the Live CD route or else boot in single-user mode.
 

randomizer

Champion
Moderator
Ubuntu disables the root account by default. The only way to enable it is by running passwd while using sudo to elevate privileges. The trouble is that you need to be logged in as another user to do this; one that is part of the sudo group as well (the first user always is).
 
You're right. OK, single-user mode it is:

1. Hold down shift whilst you start the computer. In a while you should see the Grub menu.

2. With the first item highlit, press "e".

3. Move the cursor to the end of the line that looks something like:

linux /boot/vmlinuz-2.6.32-28-generic-paeroot=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx ro vga=794 quiet splash

4. Backspace all the way up to the space before "ro".

5. Type "rw init=/bin/sh", so now it looks like:

linux /boot/vmlinuz-2.6.32-28-generic-paeroot=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx rw init=/bin/sh

6. Press F10 and let the system boot. Eventually you will end at a command line with a # prompt.

7. Type "adduser Fred" (for example) and press enter. It will ask you to type in a password and a few other details (you can just press enter on these details if you like).

8. When you've done that it will create the user and return you to the command prompt.

9. For safety's sake, type "sync" and then press return.

10. Do 9 again.

11. Do 9 again.

12. Press <Ctrl>-<Alt>-<Del> to reboot (I'm afraid that typing "reboot" won't work).

13. Once the system has rebooted and started up again you will be able to log on as "Fred" (or whatever name you chose) with the password you specified.

14. Enjoy.
 

Djhg2000

Distinguished
May 16, 2009
165
0
18,680


Frankly, that's one of the worst solutions I've seen to this issue so far. It might solve the issue at hand right now, but also create a new set of issues.

1. The shift thing isn't a generic solution, it might work on most Ubuntu installs but it certainly won't for others like Debian. Now we do know it's from 2007 which means some early release of 8.04 or earlier. Other users with similar issues (or users with unhidden GRUB menus) might find this step confusing. Still, that's the most fair assumption in your instructions.

2. Most installs already have a predefined single user mode option in the GRUB menu, not that it'd help you very much in certain cases because of the next issue.

3. If the previous owner did define a root password, you'd probably need that too.

4. Uppercase letters in the actual login name is strongly discouraged for legacy reasons, some utilities may not handle it too gracefully. While I didn't find any back in the days when I tried this on a SUSE 9.3 install, which utilities affected and any consequences are completely undefined.

5. You also forgot to tell adduser to create a home directory and a user group.

6. The "sync" command doesn't return until all disk caches have been completely flushed, meaning when you get your prompt back all data qued to be written at the time the command was issued is guaranteed to have been written.

7. If the "reboot" command doesn't work then you're either not root or have found a serious bug.

I'd aim to keep the solution as generic and simple as possible until we fully understand what we're dealing with. (At this point I might even consider suggesting a full reinstall as an option since it's bound to be an old version of Ubuntu anyway, but that's not what the OP requested.)

The main thing about my solution is that it doesn't presume the OP has any control whatsoever of any account on the HDD while yours requires root access.

Sure, a chroot may be relatively tricky to set up, but at least it has a very high success rate since you do it from a system which you do have complete control over. If you follow my instructions then I'd imagine the chroot is easier.
 
Thanks for your kind comments. I was answering the specific question asked by the OP and gave a step-by-step, tested solution. As I tested my solution I won't bother to point out the errors in your critique.

I'm sorry that my solution doesn't meet your high standards. I'll be sure to PM you next time I wish to offer an answer so that you can vet it in advance.
 

Djhg2000

Distinguished
May 16, 2009
165
0
18,680


English isn't my native language but I want to make it clear that I had no intent to offend you, and if I did I apologize, but I was only commenting on your solution.

I have tested mine as well as I have done it numerous times for friends and family who lock themselves out, usually by setting a password which they instantly forget. So in that sense our solutions are equal.

But your solution isn't generic, while it may work for you there are cases where your instructions has a different effect. If our roles were reversed I'd want someone to point out the mistakes in my instructions so that I could correct them. If you can spot any in my instructions I'd happily listen and thank you afterwards, provided you explain why.

Note that in my 7th point I didn't mean "found a serious bug" as in "likely doing something wrong", but rather as in older versions of Ubuntu actually had many serious bugs in its "reboot" command.
 
I'm not going to answer all of your points, but I do think you are wrong with several of them. In my experience the "adduser" command prompts for the group and home directory (these were some of the questions that I mentioned it will ask), you don't need a password when you start with "init=/bin/sh" (that's an old Linux trick and it's why I suggested the "init" way rather than conventional single-user mode), and "reboot" doesn't work when you start up this way. These are things I have tried and, on my Ubuntu install it works the way I describe. I really thought that I was describing the easiest procedure for the OP without having to rely on another CD, anything like that - a quick, tested fix that takes just a minute or two. But I don't want an argument.

"Frankly, that's one of the worst solutions I've seen to this issue so far" is not something that I like to read. I've had fun here, but if I'm giving solutions that are that bad then maybe it's time to admit that I'm getting a bit too old to offer useful advice. I sure hate to feel that I'm not only not helping people but that I'm positively misleading them.

Never let it be said that I can't take a hint.
 

toph

Distinguished
Aug 2, 2011
5
0
18,510
I am checking-in with all the comments coming to me. Please know that I haven't a clue about LINUX and I very much appreciate all the feedback you're all providing. I'm new to this operating system, despite my having been involved with computers and programming since 1976.

Between the last 2 of you (ijack & Djhg2000) provinding feedback, I am very hopeful I can bust a move on this sign-in bypass attempt I'm trying to achieve. As soon as I have an opportunity to try these, I will let you know how it turned out. I'll be sure to note which moves I've done, especially if leading to success, so that either of you has the feedback on your technique for future reference.

FYI - Human level? I think the words "Frankly, that's one of the worst solutions I've seen to this issue so far" -- spoken in any human language to someone who parks even a mild amount of pride in what they're offering -- is likely to find some level of personal affront. Especially when spoken with an absolute like "IS ONE OF THE WORST" when perhaps it might actually be an opinion.

Again, I'm nobody for this LINUX but I take a lot of value in people being chill-lax with each other and choosing their words so as NOT to inadvertantly offend.

Djhg2000... your English (written at least) is hardly challenged seemingly. I agree with your desire to be corrected for something that might not be correct; good to learn from mistakes and nice of you to express yourself that way back to jack.

With all the fast-shooting trolls on-line, it is far too easy for folks to be offended by others and then take it to the sarcastic or worse... in a user forum, that definitely hurts those who are seeking friendly help. You're all cool and wise from my point of view and again, THANK YOU. Will keep you posted on success...
 

Djhg2000

Distinguished
May 16, 2009
165
0
18,680


Now that I read my first line again I did really go way out of line and I would like to apologize, most of all to you but also to everyone else reading this thread. I don't know what got into me, writing such of a YouTube-troll quality statement.

Now, I didn't know of the "init=/bin/sh" trick and to me it looked like it would just do what the regular recovery solutions do. Thank you for teaching me this and I'll make sure to put it to good use.

The only reason I mentioned English isn't my native language is because a long time ago I read on a mailing list that it's the proper thing to do if you get in an argument. I hope I didn't misunderstand that part.

Once again, I apologize for my behaviour and I certainly wouldn't want you to stop teaching us youngsters a few tricks.
 

toph

Distinguished
Aug 2, 2011
5
0
18,510
Djhg2000: I'm heartened to hear you understood me cool & clean on calling you out on the "worst" commentary you opened with.

I'll balance my approach with the back-pedalling to this "init=/bin/sh" trick.

ijack: Wisdom of the ages is always welcome and I'd've thought DJHG's apology shouldn't have elicited your inclination to crawl under a rock, so to speak. Sounds like your take is the one I should be approaching in the mix, underlining DJHG's expressing "I certainly wouldn't want you to stop teaching us youngsters a few tricks" and "Thank you for teaching me this and I'll make sure to put it to good use." I take them as sincere comments and not sarcasm between the lines, in case you felt or projected it otherwise.

No good to have hurt feelings. We all know what we know. And sometimes it's not quite as simple as "either/or" but all too often "and/both". Been programming long enough to know there are short codes and long codes and there are even several ways to write code in short or long form. Hacking at things has always been thus!

Thank you and good nite. Will advise on success when I get to the laptop in the a.m. with all the various solutions printed in front of me to ply.

Cheers!!