Select Page

When using the Dataplicity service, you get logged into their default user ‘dataplicity’. You need to su into your regular user, usually ‘pi’. To make this more convenient (also less secure, so please consider yourself warned!) you can create a sudoers config to allow sudo-ing without a password, and then invoking a shell as the pi user from dataplicity user, without a password.

Based on this answer from the askubuntu forums, create a sudoers file which will contain the necessary sudo rule:

sudo nano /etc/sudoers.d/dataplicity-su

You need to add the sudo rule, and save the file:

dataplicity ALL=(pi:pi) NOPASSWD:ALL

To make this more secure, now we’ll chmod this sudoers file to be only readable:

sudo chmod 440 /etc/sudoers.d/dataplicity-su

We’ll list the contents of the sudoers.d folder to see if the permissions are all r:

pi@ansible-master:~ $ sudo ls -lah /etc/sudoers.d/*
-r--r----- 1 root root  27 Oct 18  2016 /etc/sudoers.d/010_pi-nopasswd
-r--r----- 1 root root  37 Oct 23 14:02 /etc/sudoers.d/dataplicity-su
-r--r----- 1 root root 958 Jun  5 12:22 /etc/sudoers.d/README

Then you log in to dataplicity on the web interface, you can create an alias to make logging in to the pi user even more convenient, a 2 character command. Pretty straightforward, but we won’t use the dataplicity user for anything else really anyway.

This is obviously ran as the dataplicity user:

nano ~/.bashrc

We’ll alias a command for invoking a login shell using sudo, with the flag -i. When command is not specified for -i flagged sudo, you’ll get a login shell prompt (that’s what we want), otherwise you’ll get the output of your command.

Add the alias to the very end of the file and save it:

alias pi='sudo -i -u pi'

Then re-login to dataplicity and just type in


to get logged in to the pi user withou a password.