The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

change email password via script

Discussion in 'E-mail Discussions' started by Lyttek, Feb 17, 2006.

  1. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    Greetings!

    Is it possible to change the password (or delete the password) of an email account via script? I'd like to setup a script that I can run (when needed) that will disable email access to a list of accounts.

    Basically, when a client terminates employees, I need to shut off access and would rather script it than do it by hand.
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    I don't believe that there's a script to do that. However, it should just be a simply matter of generating your own MD5 password in /home/account/etc/domain.com/shadow or comment out the mailbox name in /home/account/etc/domain.com/passwd
     
  3. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    Well, that might explain why I can't find it ;)

    Actually, commenting out the account might be easier anyway... If I were to remove the line for that account altogether, what would happen? If I went to change the password, would it choke, or simply create the password?
     
  4. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    Went ahead and tried it.

    If you comment out or remove the appropriate line in the 'shadow' file (as opposed to the passwd file), you can't login to email. You can then change the password via cpanel and all will be well.
     
  5. ElrondBCN

    ElrondBCN Active Member

    Joined:
    May 19, 2003
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Boston, MA USA
    Would you happen to know where the cpanel account passwords are kept? I'd like to be able to change those via a script as well.
     
  6. ElrondBCN

    ElrondBCN Active Member

    Joined:
    May 19, 2003
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Boston, MA USA
Loading...

Share This Page