国产探花免费观看_亚洲丰满少妇自慰呻吟_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()

總結

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

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

圖片精選

主站蜘蛛池模板: 登封市| 明星| 酒泉市| 梁平县| 郁南县| 苍南县| 阳山县| 潼关县| 荔浦县| 和田市| 新昌县| 吉林省| 南安市| 福鼎市| 湘西| 田阳县| 福清市| 昆山市| 辽阳县| 奎屯市| 中牟县| 札达县| 中方县| 德惠市| 和硕县| 铁岭市| 沁水县| 尉犁县| 顺义区| 铜川市| 崇仁县| 青河县| 麻城市| 山东| 镇江市| 常德市| 遵化市| 静海县| 遵化市| 革吉县| 泗水县|