linux - How do I view my current user/password in bash? - Unix & Linux Stack Exchange (https://cdn.sstatic.net/Sites/unix/Img/apple-touch-icon.png?v=5cf7fe716a89) (Unix & Linux Stack Exchange) (https://unix.stackexchange.com/opensearch.xml) (https://unix.stackexchange.com/questions/312113/how-do-i-view-my-current-user-password-in-bash) (Feed for question 'How do I view my current user/password in bash?') (https://unix.stackexchange.com/feeds/question/312113) (site logo) Join Unix & Linux By clicking “Sign up”, you agree to our (https://unix.stackexchange.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://unix.stackexchange.com/legal/privacy-policy) privacy policy . Sign up with Google OR Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (https://unix.stackexchange.com/users/login) Log in Skip to main content (Search on Unix & Linux…) (https://unix.stackexchange.com/help) (Help Center and other resources) (https://stackexchange.com/) (A list of all 183 Stack Exchange sites) (Click to show search) (https://unix.stackexchange.com/users/login?ssrc=head&returnurl=https%3a%2f%2funix.stackexchange.com%2fquestions%2f312113%2fhow-do-i-view-my-current-user-password-in-bash) Log in (https://unix.stackexchange.com/users/signup?ssrc=head&returnurl=https%3a%2f%2funix.stackexchange.com%2fquestions%2f312113%2fhow-do-i-view-my-current-user-password-in-bash) Sign up (https://unix.stackexchange.com/) (Unix & Linux) (https://unix.stackexchange.com/) Home (https://unix.stackexchange.com/questions) Questions (https://unix.stackexchange.com/unanswered) Unanswered (https://stackoverflow.ai/) AI Assist Labs (https://unix.stackexchange.com/tags) Tags (https://chat.stackexchange.com/rooms/158962/stack-exchange-lobby) Chat (https://unix.stackexchange.com/users) Users (https://stackoverflow.com/jobs/companies?so_medium=unix&so_source=SiteNav) Companies Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=unix-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=unix-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams (Illustration of upvote icon after it is clicked) Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? Instead, you can save this post to reference later. Save this post for later Not now (Illustration of upvote icon after it is clicked) Thanks for your vote! You now have 5 free votes weekly. Free votescount toward the total vote score does not give reputation to the author Continue to help good content that is interesting, well-researched, and useful, rise to the top! To gain full voting privileges, (https://unix.stackexchange.com/help/whats-reputation) earn reputation . Got it! Go to help center to learn more (https://cdn.sstatic.net/Sites/unix/Img/apple-touch-icon.png?v=5cf7fe716a89) (https://unix.stackexchange.com/questions/312113/how-do-i-view-my-current-user-password-in-bash) How do I view my current user/password in bash? (https://unix.stackexchange.com/questions/ask) Ask Question (2016-09-24 19:46:36Z) Asked 9 years ago Modified (https://unix.stackexchange.com/questions/312113/how-do-i-view-my-current-user-password-in-bash?lastactivity) (2024-03-22 18:02:14Z) 1 year, 6 months ago (Viewed 418,976 times) Viewed 419k times This question shows research effort; it is useful and clear 29 (This question does not show any research effort; it is unclear or not useful) Save this question. (https://unix.stackexchange.com/posts/312113/timeline) Show activity on this post. I'm currently installing Bash on Ubuntu on Windows. I installed Bash and set up the user on normally. Everything worked fine, but I didn't want to keep doing sudo with every command. I uninstalled then reinstalled 'Bash on Ubuntu on Wwindows' with lxrun /install /y It saved the username, but not the previous password. I'm trying to view the current password for the user that I am using. How do I view the password to my user in Bash? (https://unix.stackexchange.com/questions/tagged/linux) (show questions tagged 'linux') linux (https://unix.stackexchange.com/questions/tagged/bash) (show questions tagged 'bash') bash (https://unix.stackexchange.com/questions/tagged/password) (show questions tagged 'password') password (https://unix.stackexchange.com/q/312113) (Short permalink to this question) Share (https://unix.stackexchange.com/posts/312113/edit) Improve this question Follow Follow this question to receive notifications (https://unix.stackexchange.com/posts/312113/revisions) (show all edits to this post) edited (2016-09-24 19:59:39Z) Sep 24, 2016 at 19:59 user147505 asked (2016-09-24 19:46:36Z) Sep 24, 2016 at 19:46 (https://unix.stackexchange.com/users/191691/joseph-palacio) (Joseph Palacio's user avatar) (https://unix.stackexchange.com/users/191691/joseph-palacio) Joseph Palacio Joseph Palacio (reputation score) 391 (1 gold badge) 1 1 gold badge (3 silver badges) 3 3 silver badges (4 bronze badges) 4 4 bronze badges 3 I don't know if you can view the password. You can run sudo passwd yourusername to change it. If you don't have sudo access, you can run as root with lxrun /setdefaultuser root Mark Plotnick – (https://unix.stackexchange.com/users/49439/mark-plotnick) (26,003 reputation) Mark Plotnick 2016-09-24 20:07:21 +00:00 Commented (2016-09-24 20:07:21Z, License: CC BY-SA 3.0) Sep 24, 2016 at 20:07 (this comment was edited 2 times) (number of 'useful comment' votes received) 1 You can't view your password, but why would you want to do that? What are you actually trying to accomplish? If you want to configure sudo not to ask for a password, that's a different matter, it doesn't require storing any password anywhere, you just configure it not to ask for the password. If that's something specific to Linux-on-Windows then it's probably something similar but I wouldn't know. Gilles 'SO- stop being evil' – (https://unix.stackexchange.com/users/885/gilles-so-stop-being-evil) (864,432 reputation) Gilles 'SO- stop being evil' 2016-09-24 20:45:28 +00:00 Commented (2016-09-24 20:45:28Z, License: CC BY-SA 3.0) Sep 24, 2016 at 20:45 (number of 'useful comment' votes received) 1 Why do you think you need to use sudo with every command? Kusalananda – (https://unix.stackexchange.com/users/116858/kusalananda) (355,341 reputation) Kusalananda (Moderator) ♦ 2024-03-22 18:41:22 +00:00 Commented (2024-03-22 18:41:22Z, License: CC BY-SA 4.0) Mar 22, 2024 at 18:41 (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) Add a comment | (Expand to show all comments on this post) 3 Answers 3 Sorted by: (https://unix.stackexchange.com/questions/312113/how-do-i-view-my-current-user-password-in-bash?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) This answer is useful 41 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://unix.stackexchange.com/posts/312144/timeline) Show activity on this post. You can't actually, your password is hashed and is only a 1-way decoded. To summarize it, just imagine each time you try to login, it will do something like if hash ('password' ) == currentHash; do grantAccess(); and each time you save a password, will do hashedPass = hash ('password' ); writeOnShadowFile('hashedPass' ) This is by security standards of hashing avoid storing a real password, but instead storing the result of a function, and evaluating it on that way. Hashing functions are intended to do lot of the original value conversion with data loss, and due the data loss it will make almost impossible to know your original password. You can easily change your password with usermod -p , or just passwd . (https://unix.stackexchange.com/a/312144) (Short permalink to this answer) Share (https://unix.stackexchange.com/posts/312144/edit) Improve this answer Follow Follow this answer to receive notifications (https://unix.stackexchange.com/posts/312144/revisions) (show all edits to this post) edited (2020-04-20 06:41:57Z) Apr 20, 2020 at 6:41 (https://unix.stackexchange.com/users/135356/colidyre) (colidyre's user avatar) (https://unix.stackexchange.com/users/135356/colidyre) colidyre (reputation score) 193 (10 bronze badges) 10 10 bronze badges answered (2016-09-24 22:06:14Z) Sep 24, 2016 at 22:06 (https://unix.stackexchange.com/users/83053/waltercool) (WalterCool's user avatar) (https://unix.stackexchange.com/users/83053/waltercool) WalterCool WalterCool (reputation score) 551 (4 silver badges) 4 4 silver badges (6 bronze badges) 6 6 bronze badges 0 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful 14 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://unix.stackexchange.com/posts/312116/timeline) Show activity on this post. It's not possible to see what the OS user passwords are. The passwords are stored in a (https://en.wikipedia.org/wiki/Hash_function) hashed form. You can only check if you know one right. Not only would that be a security threat, but also passwords should be changed regularly. And the new one shouldn't be too similar to the old one. But in home environment (as opposed to a professional one) you shouldn't be bothered with this by your command line. (https://unix.stackexchange.com/a/312116) (Short permalink to this answer) Share (https://unix.stackexchange.com/posts/312116/edit) Improve this answer Follow Follow this answer to receive notifications (https://unix.stackexchange.com/posts/312116/revisions) (show all edits to this post) edited (2016-09-24 21:58:33Z) Sep 24, 2016 at 21:58 answered (2016-09-24 19:57:47Z) Sep 24, 2016 at 19:57 user147505user147505 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful 11 (This answer is not useful) Save this answer. (Loading when this answer was accepted…) (https://unix.stackexchange.com/posts/312117/timeline) Show activity on this post. You can't! For good reasons. It would be a huge security flaw. You can change the password with the passwd command (see man passwd ). If you are root you can change passwords for all users. (https://unix.stackexchange.com/a/312117) (Short permalink to this answer) Share (https://unix.stackexchange.com/posts/312117/edit) Improve this answer Follow Follow this answer to receive notifications (https://unix.stackexchange.com/posts/312117/revisions) (show all edits to this post) edited (2024-03-22 17:47:57Z) Mar 22, 2024 at 17:47 (https://unix.stackexchange.com/users/117549/jeff-schaller) (Jeff Schaller's user avatar) (https://unix.stackexchange.com/users/117549/jeff-schaller) Jeff Schaller (Moderator) ♦ (reputation score 68,771) 68.8k (35 gold badges) 35 35 gold badges (122 silver badges) 122 122 silver badges (263 bronze badges) 263 263 bronze badges answered (2016-09-24 19:59:24Z) Sep 24, 2016 at 19:59 anonanon 0 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) You must (https://unix.stackexchange.com/users/login?ssrc=question_page&returnurl=https%3a%2f%2funix.stackexchange.com%2fquestions%2f312113) log in to answer this question. Start asking to get answers Find the answer to your question by asking. (https://unix.stackexchange.com/questions/ask) Ask question Explore related questions (https://unix.stackexchange.com/questions/tagged/linux) (show questions tagged 'linux') linux (https://unix.stackexchange.com/questions/tagged/bash) (show questions tagged 'bash') bash (https://unix.stackexchange.com/questions/tagged/password) (show questions tagged 'password') password See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/09/24/the-history-and-future-of-software-development-part-1/?cb=1) The history and future of software development (part 1) (https://stackoverflow.blog/2025/09/26/getting-backstage-in-front-of-a-shifting-dev-experience/?cb=1) Getting Backstage in front of a shifting dev experience Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/412667/spevacus-has-joined-us-as-a-community-manager?cb=1) Spevacus has joined us as a Community Manager (Meta Stack Exchange) (https://meta.stackexchange.com/questions/412705/introducing-a-new-proactive-anti-spam-measure?cb=1) Introducing a new proactive anti-spam measure Related (https://unix.stackexchange.com/questions/28791/prompt-for-sudo-password-and-programmatically-elevate-privilege-in-bash-script?rq=1) (Question score (upvotes - downvotes)) 70 (https://unix.stackexchange.com/questions/28791/prompt-for-sudo-password-and-programmatically-elevate-privilege-in-bash-script?rq=1) Prompt for sudo password and programmatically elevate privilege in bash script? (https://unix.stackexchange.com/questions/64775/how-to-enter-choose-session-after-logout-without-password-in-linux-mint-xfce?rq=1) (Question score (upvotes - downvotes)) 2 (https://unix.stackexchange.com/questions/64775/how-to-enter-choose-session-after-logout-without-password-in-linux-mint-xfce?rq=1) How to enter/choose session after logout without password in (Linux Mint) Xfce? (https://unix.stackexchange.com/questions/81181/graphically-ask-for-password-in-a-bash-script-and-retain-default-sudo-timeout-se?rq=1) (Question score (upvotes - downvotes)) 10 (https://unix.stackexchange.com/questions/81181/graphically-ask-for-password-in-a-bash-script-and-retain-default-sudo-timeout-se?rq=1) Graphically ask for password in a bash script and retain default sudo timeout setting (https://unix.stackexchange.com/questions/159454/is-w-command-safe-for-users?rq=1) (Question score (upvotes - downvotes)) 7 (https://unix.stackexchange.com/questions/159454/is-w-command-safe-for-users?rq=1) Is w command safe for users? (https://unix.stackexchange.com/questions/663330/why-is-my-virtual-machine-still-asking-a-user-for-password-after-i-deleted-its-p?rq=1) (Question score (upvotes - downvotes)) 0 (https://unix.stackexchange.com/questions/663330/why-is-my-virtual-machine-still-asking-a-user-for-password-after-i-deleted-its-p?rq=1) Why is my virtual machine still asking a user for password after I deleted its password? (https://unix.stackexchange.com/questions/693059/how-do-i-login-as-the-root-user?rq=1) (Question score (upvotes - downvotes)) 0 (https://unix.stackexchange.com/questions/693059/how-do-i-login-as-the-root-user?rq=1) How do I login as the root user? (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Bicycles Stack Exchange) (https://bicycles.stackexchange.com/questions/97531/is-my-new-stem-too-tight-for-my-carbon-fork) Is my new stem too tight for my carbon fork? (Database Administrators Stack Exchange) (https://dba.stackexchange.com/questions/347849/best-solution-to-prevent-loop-between-tables-for-granular-relations) Best solution to prevent loop between tables for granular relations (Academia Stack Exchange) (https://academia.stackexchange.com/questions/221464/find-non-trivial-improvement-after-submitting) Find non-trivial improvement after submitting (Astronomy Stack Exchange) (https://astronomy.stackexchange.com/questions/61755/what-real-mistakes-exist-in-the-messier-catalog) What "real mistakes" exist in the Messier catalog? (Chess Stack Exchange) (https://chess.stackexchange.com/questions/47364/are-there-any-world-leaders-who-are-were-good-at-chess) Are there any world leaders who are/were good at chess? (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/216632/what-is-the-occultist-class-in-5e) What is the Occultist class in 5e? (Science Fiction & Fantasy Stack Exchange) (https://scifi.stackexchange.com/questions/299399/clinical-tone-story-about-earth-making-people-violent) Clinical-tone story about Earth making people violent (Information Security Stack Exchange) (https://security.stackexchange.com/questions/282177/storing-a-session-token-in-localstorage) Storing a session token in localstorage (Worldbuilding Stack Exchange) (https://worldbuilding.stackexchange.com/questions/269188/are-there-any-alternatives-to-electricity-that-work-behave-in-a-similar-way) Are there any alternatives to electricity that work/behave in a similar way? (Politics Stack Exchange) (https://politics.stackexchange.com/questions/93638/who-is-the-target-audience-of-netanyahus-speech-at-the-united-nations) Who is the target audience of Netanyahu's speech at the United Nations? (Spanish Language Stack Exchange) (https://spanish.stackexchange.com/questions/45238/why-is-the-definite-article-used-in-mi-deporte-favorito-es-el-f%c3%batbol) Why is the definite article used in “Mi deporte favorito es el fútbol”? (Movies & TV Stack Exchange) (https://movies.stackexchange.com/questions/128433/why-weren-t-prince-philip-s-sisters-invited-to-his-wedding-to-princess-elizabeth) Why weren’t Prince Philip’s sisters invited to his wedding to Princess Elizabeth? (Retrocomputing Stack Exchange) (https://retrocomputing.stackexchange.com/questions/32112/bypassing-c64s-petscii-to-screen-code-mapping) Bypassing C64's PETSCII to screen code mapping (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5098430/do-sum-of-natural-numbers-and-sum-of-their-squares-represent-uniquely-the-summan) Do sum of natural numbers and sum of their squares represent uniquely the summands? (Stack Overflow) (https://stackoverflow.com/questions/79774609/exchange-a-file-in-a-zip-file-quickly) Exchange a file in a zip file quickly (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/323263/how-big-of-a-hole-can-i-drill-in-an-exterior-walls-bottom-plate) How big of a hole can I drill in an exterior wall's bottom plate? (Worldbuilding Stack Exchange) (https://worldbuilding.stackexchange.com/questions/269225/can-peaty-boggy-wet-soggy-marshy-ground-be-solid-enough-to-support-several-tonne) Can peaty/boggy/wet/soggy/marshy ground be solid enough to support several tonnes of minutely foot traffic but NOT support a road? (Seasoned Advice) (https://cooking.stackexchange.com/questions/133163/lingering-odor-presumably-from-bad-chicken) Lingering odor presumably from bad chicken (Cross Validated) (https://stats.stackexchange.com/questions/670453/survival-analysis-is-a-cure-model-a-good-fit-for-my-problem) Survival analysis - is a cure model a good fit for my problem? (Law Stack Exchange) (https://law.stackexchange.com/questions/110997/can-a-state-execute-an-icc-arrest-warrant-in-international-waters) Can a state execute an ICC arrest warrant in international waters? (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/323298/how-to-home-make-rubber-feet-stoppers-for-table-legs) How to home-make rubber feet stoppers for table legs? (Open Source Stack Exchange) (https://opensource.stackexchange.com/questions/15612/what-license-to-use-when-extending-a-pre-existing-library) What license to use when extending a pre-existing library? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/751721/how-can-i-convert-simple-and-complex-latex-math-to-plain-unicode-text) How can I convert simple and complex LaTeX math to plain Unicode text? more hot questions (https://unix.stackexchange.com/feeds/question/312113) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://unix.stackexchange.com/feeds/question/312113) () lang-bash Why are you flagging this comment? (20) It contains harassment, bigotry or abuse. This comment attacks a person or group. Learn more in our (https://unix.stackexchange.com/conduct/abusive-behavior) Code of Conduct . (40) It's unfriendly or unkind. This comment is rude or condescending. Learn more in our (https://unix.stackexchange.com/conduct/abusive-behavior) Code of Conduct . (39) Not needed. This comment is not relevant to the post. (19) Something else. A problem not listed above. Try to be as specific as possible. Flag comment Cancel You have 0 flags left today (https://unix.stackexchange.com/) Unix & Linux (https://unix.stackexchange.com/tour) Tour (https://unix.stackexchange.com/help) Help (https://chat.stackexchange.com/?tab=all&sort=active) Chat (https://unix.stackexchange.com/contact) Contact (https://unix.meta.stackexchange.com/) Feedback (https://stackoverflow.co/) Company (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.co/teams/) Teams (https://stackoverflow.co/advertising/) Advertising (https://stackoverflow.co/advertising/employer-branding/) Talent (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service Your Privacy Choices (https://policies.stackoverflow.co/stack-overflow/cookie-policy) Cookie Policy (https://stackexchange.com/) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog/?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.9.26.34547 Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group. This site is not affiliated with Linus Torvalds or The Open Group in any way. By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our (https://policies.stackoverflow.co/stack-overflow/cookie-policy/) Cookie Policy . Accept all cookies Necessary cookies only Customize settings