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

首頁 > 開發 > JS > 正文

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

2024-05-06 16:45:17
字體:
來源:轉載
供稿:網友

前言

本文主要介紹了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()

總結

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


注:相關教程知識閱讀請移步到JavaScript/Ajax教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 昆山市| 彭水| 稷山县| 万载县| 茂名市| 尤溪县| 崇文区| 永善县| 丰都县| 广河县| 上栗县| 云霄县| 莱州市| 永清县| 塘沽区| 湟中县| 泰顺县| 方正县| 白银市| 南丹县| 蛟河市| 巴中市| 鄂伦春自治旗| 客服| 高要市| 遂溪县| 保靖县| 福海县| 江山市| 墨玉县| 陆河县| 黎川县| 绍兴市| 花莲县| 武威市| 永城市| 朝阳区| 连江县| 治县。| 罗江县| 威远县|