I am using Raspberry Pi 2 with Jessie raspbian release. I ran into a problem when i was trying to make vncserver start at boot. I followed the instructions present in raspberry pi's website to start vncserver on boot. But after following the instructions specified, my raspberry pi's command line always stays in root mode.

root@raspberry pi:/home/pi#

I guess it was because of the command that's specified in those instructions which had - sudo su command. How do i get pi user back in the command line like this -


I tried with these instructions but they didn't help.

Update: I am using my mac to login into Pi and then start vncserver. Now,

  • when i run command whoami in mac -> i get pi as output.
  • when i run command whoami in pi console -> i get root as output. (I start vncserver in mac command line, then open vnc connection to work on pi console).

Any suggestions on what's happening?


2 Answers 2


To return to the Pi user just type exit.

  • Tried that, but it switched to normal user temporarily. When i re-started my terminal, it had root user showing up again. Thanks
    – giri-sh
    Dec 26, 2015 at 17:40
  • @GirishSortur what is the output of whoami? Dec 26, 2015 at 22:14
  • I get root as the output of whoami.
    – giri-sh
    Dec 27, 2015 at 6:46
  • Are you perhaps running a saved session using screen or tmux? Dec 30, 2015 at 4:47
  • I dont think so. I did shutdown and start my raspberry pi several times. I am not sure how its getting saved. Will debug it more.
    – giri-sh
    Dec 30, 2015 at 7:45

I am not exactly what you have done, because if you followed the instructions there should be no problem. (I assume you have rebooted.)

vnc is unlikely to work, because those instructions are for SysV. If you are running Jessie this should be started with a systemd service.

See https://raspberrypi.stackexchange.com/a/39374/8697

  • I did reboot my pi several times. I will try using systemd service and see if it resolves my issue. Also does sudo su command create any problem, because when i googled it i found that su command is used to switch user (In my case it got switched to root user). Thanks.
    – giri-sh
    Dec 27, 2015 at 6:48
  • @GirishSortur sudo su (actually su) is the "switch user" command. Without a target it switches to root. Try reading man su. You seem to have (at least) 2 problems here. First fix login (delete all the files you created, or restore any you changed) before worrying about vnc.
    – Milliways
    Dec 27, 2015 at 7:39
  • I did that already. I removed all the files i created. But only thing i wasn't able to fix was switch the user back to pi from root. I tried most of the methods i googled, but none worked. Thanks
    – giri-sh
    Dec 27, 2015 at 7:54

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.