国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

Node.js命令行/批處理中如何更改Linux用戶密碼淺析

2024-05-06 15:32:33
字體:
來源:轉載
供稿:網友

前言

本文主要介紹了Node.js命令行/批處理更改Linux用戶密碼的相關內容,分享出來供大家參考學習,下面話不多說了,來一起看看詳細的介紹吧

hpasswd 可在批處理文件中批量更改Linux用戶的密碼。

用法:

chpasswd [options]

option主要為一些密碼加密選項

-c, --crypt-method
Use the specified method to encrypt the passwords.
The available methods are DES, MD5, NONE, and SHA256 or SHA512 if your libc support these methods.
-e, --encrypted
Supplied passwords are in encrypted form.
-h, --help
Display help message and exit.
-m, --md5
Use MD5 encryption instead of DES when the supplied passwords are not encrypted.
-s, --sha-rounds
Use the specified number of rounds to encrypt the passwords.
The value 0 means that the system will choos

輸入命令后,按 username:password 格式輸入用戶名密碼,一行一個,如:

chpasswdnewghost:4567

用這種方法可在node.js中使用:

var cp = require('child_process')//更新密碼var chpasswd = cp.spawn('chpasswd')var errmsg//查看是否有錯誤chpasswd.stderr.on('data', function (data) { errmsg += data.toString()})chpasswd.on('exit', function(code) { if (cb) { errmsg  ? cb(new Error(errmsg))  : cb() }})//寫入密碼chpasswd.stdin.write(username + ':' + password)chpasswd.stdin.end()

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對錯新站長站的支持。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 托克托县| 田东县| 阿图什市| 永靖县| 广丰县| 错那县| 诸城市| 济源市| 琼中| 普兰县| 和平区| 莲花县| 磐石市| 济宁市| 宣武区| 静乐县| 石首市| 富平县| 龙南县| 肇庆市| 伊宁县| 五峰| 高密市| 石家庄市| 沙坪坝区| 双城市| 阳新县| 湾仔区| 延庆县| 沁阳市| 兰考县| 丰原市| 涞源县| 泸溪县| 图片| 秦皇岛市| 牙克石市| 如东县| 阜宁县| 包头市| 双牌县|