twitter linkedin youtube
  • About
  • Blog
  • My Services
  • Twitter
  • LinkedIn
  • Email
All tags

    sed replacing a string in a file

    Simple example of replacement of a password field in /etc/shadow. usern=robbie encpass= :$1$CQoPk7Zh$370xDLmeGD9m4aF/ciIlC sed -i "s/^${usern}\:[^\:]\{1,100\}\:/${usern}\:${encpass}\:/" /etc/shadow Probably some more improvements here (e.g. determine maximum hashed password string length rather than "up to 100"…

    Read More
    • linux
    • sed

    Load more posts
    Subscribe!
    All content copyright © 2025 • All rights reserved.
    Proudly published with Ghost