{"id":1647,"date":"2024-03-01T00:00:00","date_gmt":"2024-03-01T05:00:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=1647"},"modified":"2024-02-02T14:55:34","modified_gmt":"2024-02-02T19:55:34","slug":"passwd-cheat-sheet","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/passwd-cheat-sheet\/","title":{"rendered":"passwd Cheat Sheet"},"content":{"rendered":"\n<p>The <code>passwd<\/code> command in Unix-like operating systems is used for changing user passwords. It provides various options for password management. This cheat sheet covers essential <code>passwd<\/code> commands for users and system administrators.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Introduction:<\/strong><\/h4>\n\n\n\n<p>The <code>passwd<\/code> command is a crucial tool for managing user passwords on Unix-based systems. It allows users to change their own passwords and administrators to modify other user accounts.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Basic Commands:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>passwd<\/code><\/td><td>Change the password for the current user.<\/td><\/tr><tr><td><code>passwd [username]<\/code><\/td><td>Change the password for a specific user (requires sudo).<\/td><\/tr><tr><td><code>passwd -l [username]<\/code><\/td><td>Lock the password of a user account.<\/td><\/tr><tr><td><code>passwd -u [username]<\/code><\/td><td>Unlock the password of a previously locked account.<\/td><\/tr><tr><td><code>passwd -d [username]<\/code><\/td><td>Delete the password of a user account (set to empty).<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Password Policies:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>passwd -e [username]<\/code><\/td><td>Expire the password of a user, forcing them to change it on next login.<\/td><\/tr><tr><td><code>passwd -n [min_days] [username]<\/code><\/td><td>Set the minimum number of days between password changes.<\/td><\/tr><tr><td><code>passwd -x [max_days] [username]<\/code><\/td><td>Set the maximum number of days a password is valid.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Administrative Commands:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>passwd -S [username]<\/code><\/td><td>Display the password status (age, expire, etc.) for a user.<\/td><\/tr><tr><td><code>passwd -l -e [date] [username]<\/code><\/td><td>Lock and expire a user account on a specific date.<\/td><\/tr><tr><td><code>passwd -S -a<\/code><\/td><td>Display password status for all user accounts.<\/td><\/tr><tr><td>`passwd -S -a<\/td><td>awk &#8216;$2 ~ \/LK\/ {print $1}&#8217;`<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Security Tips:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>passwd --stdin [username]<\/code><\/td><td>Set the password from standard input (useful for scripts).<\/td><\/tr><tr><td><code>passwd --warndays [days] [username]<\/code><\/td><td>Set the number of days before a password expires to give a warning.<\/td><\/tr><tr><td><code>passwd --mindays [days] [username]<\/code><\/td><td>Set the minimum number of days between password changes.<\/td><\/tr><tr><td><code>passwd --maxdays [days] [username]<\/code><\/td><td>Set the maximum number of days a password is valid.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Miscellaneous:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>passwd --status<\/code><\/td><td>Display the password status for the current user.<\/td><\/tr><tr><td><code>passwd --help<\/code><\/td><td>Display help and usage information for <code>passwd<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>The <code>passwd<\/code> command is a fundamental tool for managing user passwords on Unix-like systems. This cheat sheet provides essential commands for users and administrators to change passwords, set password policies, and perform administrative tasks. Whether you are an individual user or a system administrator, these commands will help you effectively manage user passwords on your Unix-based system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The passwd command in Unix-like operating systems is used for changing user passwords. It provides various options for password management. This cheat sheet covers essential passwd commands for users and system administrators. Introduction: The passwd command is a crucial tool for managing user passwords on Unix-based systems. It allows users to change their own passwords [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,265],"tags":[35],"class_list":["post-1647","post","type-post","status-publish","format-standard","hentry","category-linux","category-reference","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=1647"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1647\/revisions"}],"predecessor-version":[{"id":1648,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1647\/revisions\/1648"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=1647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=1647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=1647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}