简体   繁体   中英

How to copy generated string and paste in config file in linux

Noob question.

I am generating a hash using a script. Now I want to use the hash as a password in my tomcat users file.

How should I go about this without using any GUI, since I am working on a server.

You're encrypting a password, yes?

printf "%s" "password_string" | md5sum | cut -d" " -f1

You need the printf invocation to ensure a newline does not get appended to the password.

There's also sha1sum , if you prefer to use that. These commands, I believe, are part of the openssl package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM