I am trying to change the password on a Pi sd card. However, each time I edit the cmdline.txt with init=/bin/sh, I eject, put it into my pi and it loads up right to the normal user sign in. So, I inserted the card into my computer and noticed that any time I eject the card the changes are not saved. The file is not marked as read only.

Here is what I have tried:

Renaming the file... After ejecting, and reinserting, a new cmdline.txt had been generated.

Editing it in sudo... Doesn't save changes.

I am editing the files in Ubuntu 16.04

Any suggestions?


  • You say your are trying to "change the password on a Pi sd card" and "edit the cmdline.txt". What password are you trying to change? Why (and how) are you trying to "edit the cmdline.txt"?
    – Milliways
    Mar 25, 2017 at 4:29
  • I want to change the user password. I was editing the file by opening the boot file directory on a separate linux machine.
    – rutheferd
    Mar 25, 2017 at 16:48

1 Answer 1


To change password login to the Pi and use the Raspberry Pi Configuration menu in GUI or raspi-config from the command line.

Alternatively you could use the passwd command.

It is not impossible to change password on another Linux system, but this has nothing to do with cmdline.txt.

  • My issue is that I am not able to access the pi. I set the pi up a while back and have forgotten the login details. I have read that there is methods to change the password by editing the cmdline.txt file allowing the system to boot into single user mode.
    – rutheferd
    Mar 28, 2017 at 23:12
  • Do NOT put additional detail into comments. This should be edited into your question, and you should have mentioned that you forgot your password. As it stands, it is unclear whether you don't know how to edit cmdline.txt or don't know how to use single user mode.
    – Milliways
    Mar 29, 2017 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.