Raspberry Pi running Raspbian (2014-01-07)

The error seems to have come from nowhere, as I was trying to log in as root via SSH (yes I have it activated - for now) I got the message "Access Denied" which felt wrong since I am the owner of the raspberry pi, I had set up the whole thing and I was the one who created the user's password. I went to the physical Raspberry Pi, hooked it up to a monitor, and tried to log in.

What followed was a failed attempt to access my pi, well, I could log in, but I was immediately met with the "MyHostName login:"

What I saw on-screen, step by step:

"MyHostName login:"

I entered "root" to log in as that user

"Password:" I entered my password and hit return.

Last login: Fri Mar 28 14:38:11 CET 2014 on tty1
Linux MyHostName 3.10.34+ #660 PREEMPT TUe Mar 25 15:04:00 GMT 2014 armv61

The programs included with the Debian Gnu/Linux [...]
permitted by applicable law.
No directory, logging in with Home=/
Cannot execute /root:bin:bash: No such file or directory

Raspbian GNU/Linux 7 MyHostName tty

MyHostName login:

As you can see I can, well not quite but still, log in - but I am immediately signed out again.

Unfortunately, I have not set up other sudoers so I can not access the /etc/passwd to try and correct whatever's wrong.

I had finally set it up as a LAMP-server, everything was up and running and now this... All I hope is that I don't have to re-flash the SD.

  • Something is screwy. Boot it into single-user mode. You'll need to connect the Pi to a monitor, though.
    – Nathan C
    Mar 28, 2014 at 14:13
  • On that note, if you have another linux machine laying around (or set up Windows so it can read ext partitions) you can pop the SD card into your computer and modify the files directly.
    – Nathan C
    Mar 28, 2014 at 14:14
  • @NathanC I thought of that too, but from what I could find, all the extensions available only allows to read the partition and not write to it.
    – Alex
    Mar 28, 2014 at 14:39
  • Try ext2fsd.com perhaps?
    – Nathan C
    Mar 28, 2014 at 15:04
  • @NathanC When I have installed it, I insert my SD Card, open the Manager and click on the linux partition of the drive, correct? When I then click on "Add mount point" and proceed to try to add one, the program freezes for a second or two indicating something is happening, but the drive won't mount. No error messages or anything.
    – Alex
    Mar 28, 2014 at 15:14

3 Answers 3


This problem isn't related to the root password, it's related to the shell in /etc/passwd:


Your shell in /etc/passwd needs to exist, and should match an entry in /etc/shells.

Also, it appears the general format of your /root line is amiss, as it cannot identify the home directory field.

If single user mode doesn't work, you can always boot into some live device, such as USB drive, mount the / filesystem and edit /etc/passwd directly. The root line should look something like:

  • It's worth to mention two things: (1) To avoid such errors in /etc/passwd use vipw tool. (2) Booting into a live device may not be easy with Raspberry Pi; mounting its SD card in another Linux machine and editing from there may be a lot easier. May 12, 2017 at 22:04

You can boot into single user mode and simply change the password with passwd root once you have a prompt. Answer from the comments.


Change root password:

sudo passwd root

Enable root SSH access:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

Restart SSH:

sudo service ssh restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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