Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
I have tried to changed my username and password, I don't exactly know the name / terms for this, : in terminal there is a host-name, like: first-name(at)last-name $ , ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2013
    Posts
    47

    Linux Mint 14, green member, lost username and password, 64 bits


    I have tried to changed my username and password, I don't exactly know the name / terms for this, : in terminal there is a host-name, like: first-name(at)last-name $ , more or less like that, now I have changed successfully the (at)last-name, which appeared after a reboot,

    I used a video guide:

    Syntax used in the video:
    sudo gedit /etc/hosts
    sudo gedit /etc/hostname

    btw. I use pluma editor

    this guide changes what I call the (at)last-name, not the first-name(at)

    so far so good

    to change the password , I used the:

    passwd

    and as far as I remember, I had changed to SU, I don't know if that makes any difference, but anyway, I successfully changed the password too.

    Now to the problem:

    I can't log in successfully any more, not the new neither the old username and/or password works in any whatsoever combination.

    How can I solve this issue?

    Thanks,



    Wrenchman

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,408
    It is still not clear what you did to change your user name/id. /etc/hosts is just a list of know remote systems (useful only if you don't have a properly configured DNS server handy), and /etc/hostname is just the name of your local system for the local (or larger) network. They have zip to do with user credentials.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    May 2013
    Posts
    47
    I did do another thing, using this example:

    Task: Change username from tom to jerry

    Type usermod command as follows:
    # id tom
    # usermod -l jerry tom
    # id jerry
    # id tom

    (using my own names)

    could that be the promlem?

    Again I don't remember if I was a SU.

    But nothing seemed to happen, since the name after the (at) had already changed with the first mentioned command line (/etc/hosts, /etc/hostname), and I never wanted to change it again, I was trying to change the first part of the name before the (at), in terminal

    Thanks,



    Wrenchman

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    hi,

    just so you're clear on this, when you are talking about first-name(@)last-name when in a terminal, that is called your prompt. In Bash, it is specifically Prompt String One, or PS1. you should see this getting defined in one of your Bash login scripts (/etc/bashrc, ~/.bashrc, etc.). in a simple form, it could be defined like this:
    Code:
    PS1='[\u@\h \W]$ '
    where \u is userid, \h is the hostname, and \W is the current working directory.

    So in the prompt, the first-name part (before the @ sign) is your userid, which is defined in the file /etc/passwd. You should get the same userid when running these commands:
    Code:
    echo $USER
    id -un
    whoami
    The last-name part (after the @ sign) is the system hostname (usually defined in /etc/sysconfig/network, or /etc/hostname, for example - it depends on the distro). you should get the same hostname by running these commands:
    Code:
    echo $HOSTNAME
    hostname
    Last edited by atreyu; 05-24-2013 at 12:03 AM. Reason: typo-mania

  5. #5
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,482
    It looks to me as if you had a user called tom and you changed tom's login name to jerry. Can you log in as jerry?
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  6. #6
    Just Joined!
    Join Date
    May 2013
    Posts
    47
    thanks for the explanation atreyu, I understood just about zero balls, lol, although I do comprehend the essence of the explanation, which is:

    let me see if I get this right,

    1. prompt is the complete name in a terminal box, (identifying the owner and the computer)
    2. first part of the prompt is userid
    3. second part of the prompt is the system hostname
    4. Bash login scripts? no clue!
    5. running a command? is it possible to run a command without logging in first?

    (at)elija

    yes I did change my system hostname from nmfd(at)nmfd-12345 $ to nmfd(at)Marius $

    I never yet did have success changing my userid (afaik)

    I did successfully change my password, using the command passwd in a terminal box.

    I changed the password from being a word, to a number, using num pad, but I'm not sure if num lock was turned on, could that make a difference?

    I still have no success logging in!

    Where do we go from here?

    Thanks,



    Wrenchman

  7. #7
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by Wrenchman View Post
    1. prompt is the complete name in a terminal box, (identifying the owner and the computer)
    yes, but not necessarily the owner and computer. it is whatever you set the variable PS1 to, in Bash anyway. see this picture which explains a prompt:

    login-PS1.png

    2. first part of the prompt is userid
    3. second part of the prompt is the system hostname
    in this case, yes, and the 3rd part is the current working dir (the dir you are in, or the output of the pwd command).

    4. Bash login scripts? no clue!
    they are basically just simple scripts that set environmental variables and aliases and do a few other things for you. there are system ones, which set sane things for all users, and your personal ones, which you should definitely get used to at least looking at, if not modifying. Read up on them in the bash man page. in a terminal, type this command:
    Code:
    man bash
    you can also view an HTML-ized version here.

    5. running a command? is it possible to run a command without logging in first?
    No! if you are having trouble logging in (I think you screwed up your password?), then you may need to boot into run level 1. I think you can do that in Mint anyway. When you boot into run level 1 (or single user mode) you are dropped directly to a shell as the root user, who can do anything (like change user passwords).

    If you can't boot into run level 1, then you may need to boot with the Mint (or any Linux) CD and go into rescue/Live mode to reset the user password.

  8. #8
    Just Joined!
    Join Date
    May 2013
    Posts
    47
    Thank you atreyu for the informative private lesson, very interesting.

    I will definitely look at bash man, oops I mean man bash

    Anyway, Brahim from Mint, gave me a link, about how to reset a password, so I had a look at that, and here's what happend

    Reset password

    recovery mode

    mount -o rw,remount(which I did not do)

    At some point the prompt and/or the bash said:

    Give root password for maintenance, or control D to continue!

    so I tried the "old" password, which worked, giving this result:

    Marius ~ #

    then I tried:

    Marius ~ # ls/home
    bash: ls/home: file or directory not found

    Marius ~ # ls

    still nothing, only showing some suggestions, I didn't write it down so I don't remember, after that I:

    exit

    So I guess I have to go back there and type the PW which will bring me to super root user:

    Marius ~ #

    then type:

    Marius ~ # passwd

    am I right?

    no sure either if I have to do the:

    mount -o rw,remount(is that comma supposed to be there)

    I guess I'm not in a hurry, so I'll wait for an answer before I screw things up (believe me on that point I'm an expert)

  9. #9
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by Wrenchman View Post
    Anyway, Brahim from Mint, gave me a link, about how to reset a password, so I had a look at that, and here's what happend

    Reset password

    recovery mode

    mount -o rw,remount(which I did not do)
    you NEED to do that, so that you can write to your Linux root filesystem (particularly, so you can modify the /etc/passwd file and possibly /etc/shadow file).

    Give root password for maintenance, or control D to continue!

    so I tried the "old" password, which worked, giving this result:

    Marius ~ #
    that's good. so you are root now (indicated by the "#" sign in your prompt).

    then I tried:

    Marius ~ # ls/home
    bash: ls/home: file or directory not found
    you need a space after the "ls" and before the "/home". you are "listing" the directory "/home".

    So I guess I have to go back there and type the PW which will bring me to super root user:

    Marius ~ #

    then type:

    Marius ~ # passwd

    am I right?
    you want to pass the username to the passwd command, so say:
    Code:
    passwd myusername
    where "myusername" is the user name you are trying to log in with but can't b/c you forgot the password.

    no sure either if I have to do the:

    mount -o rw,remount(is that comma supposed to be there)
    yes, you have to do that mount command first, and yes, that comma must be there. both "rw" and "remount" are mount options (indicated by the "-o") to the mount program.

  10. #10
    Just Joined!
    Join Date
    May 2013
    Posts
    47
    Again thank you, I'll have a look at it right now!

    I'll see you on the other side.



    Wrenchman

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •