Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
I have a little problem here. From what I've learnt at internet to change the user account's password is like this (the user name is guest) : usermod -p password ...
  1. #1
    Just Joined! garry_3peace's Avatar
    Join Date
    Oct 2008
    Posts
    67

    change user account password

    I have a little problem here. From what I've learnt at internet to change the user account's password is like this (the user name is guest) :

    usermod -p password guest
    But somehow, it still didn't change the password. Additional question, if we want to create a new account, we just need to type this, isn't

    useradd guest -p password
    Is there any mistakes on the syntax?

  2. #2
    Just Joined! TuxKnight's Avatar
    Join Date
    Sep 2008
    Location
    New Zealand
    Posts
    28
    Try this

    As root run the following command

    passwd guest

    This worked ok
    useradd guest -p password

  3. #3
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    If you use usermod to change a user's password the -p option requires you pass the encrypted password. That's why it didn't work, you didn't encrypt the password.

    As TuxKnight suggested use the passwd command to change the user's password.

  4. #4
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,093
    Here's a HowTo you can check for resetting both, root and user passwords:

    http://www.linuxforums.org/forum/lin...-password.html
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  5. #5
    Just Joined! garry_3peace's Avatar
    Join Date
    Oct 2008
    Posts
    67
    oh thanks everyone. Btw how do we get encrypted password then? Let's say if I want to use usermod -p , what should I do?

  6. #6
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    If you wanted to have an encrypted password, you're basically doing what the passwd tool does. Basically, given a string, you first select your encryption mechanism: either DES or MD5.

    You then need to generate what is called a salt. This is a random sequence of characters that will be used to encrypt the password. You then employ the chosen encryption algorithm using the salt and the password to generate an encrypted password.

    The only time that I've ever done this was for kicks and giggles, and it's fairly simple to use glibc functions for it (except for generating a secure salt: that's more complicated).
    DISTRO=Arch
    Registered Linux User #388732

  7. #7
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    You could use perl's crypt function to encrypt a password. Here's a very simple example:

    Code:
    #!/bin/bash -vx
    
    tmp="`perl -e 'print crypt("abcdefg",756);'`"
    usermod -p "$tmp" test
    The password is "abcdefg" and the salt is 756. You could use $RANDOM for the salt if you want.

  8. #8
    Just Joined! garry_3peace's Avatar
    Join Date
    Oct 2008
    Posts
    67
    Ah.. I see..
    but there is something I don't understand. The result of DES mechanism surely is different with MD5 isn't it? Let say I encrypt with DES mechanism, how can the Linux know that the password argument that I give is using DES Mechanism not MD5. Btw, when I login, I type the plain text, Linux need to convert it to the encrypt text first before comparing the word right?

  9. #9
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    To the best of my knowledge Linux uses only DES in encrypting passwords. Perl's crypt function uses DES.

    Linux Online - Password Security and Encryption

    Not sure what Cadhan was talking about wrt MD5.

  10. #10
    Just Joined! garry_3peace's Avatar
    Join Date
    Oct 2008
    Posts
    67
    I read man, it said it can be md5, if we configure the pam. Talking about pam, is that a program? I have a little problem on that thing(I have posted it at Redhat).

    Anyway thanks for the link.

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
  •  
...