1

New to Pi and I am trying to configure my Pi3. I would like to keep the user pi intact with the factory password, but still be able to use VNC and SSH without getting the security error message.

I thought I would be able to create a new user, turn off SSH and VNC for pi and turn on SSH and VNC for the new user. Unfortunately, I get the repeated error connection refused.

Also when I initially attempted to adjust the user's configuration setting under Preferences -> RaspberryPi Configuration I got an error message about not being able to create or copy the configuration file. I assume this error was because the user did not have sufficient rights to do so.

My ultimate goal is to leave the user pi only accessible locally, while any other user(s) of my choosing can have remote access.

2 Answers 2

5

SSH

SSH is achieved just by creating a new user (useradd) and making a small edit to sshd_config. First lets create the user:

useradd UserName
passwd UserName

Once the user is created, if you want it to have root access, add it to the sudo group:

usermod -aG sudo UserName

Next we want to edit the sshd_config as root:

sudo -s
nano /etc/ssh/sshd_config

Once editing sshd, add this line to the configuration:

AllowUsers UserName

Press CTRL+X, y to accept the changes, enter to confirm the title of the file (overwriting).

Now for this configuration to take place, we need to restart SSH:

service ssh restart

Here is a great guide on VNC, and although it's about CentOS, the commands are the same :

https://wiki.centos.org/HowTos/VNC-Server#head-2af7c99dd1f5f5b6c8bd1d4b4ada5e4823184064

1
  • This is the right way to do it, but I'm a little bummed that the integrated preferences panel won't allow you to control settings like this per user. Thank you for your time and effort. Jan 13, 2018 at 15:41
1

I just updated my pi to raspian stretch and the link for the vnc config does not reflect the changes in that the following directory doesnt exit /etc/sysconfig/.....: https://wiki.centos.org/HowTos/VNC-Server#head-2af7c99dd1f5f5b6c8bd1d4b4ada5e4823184064

I just opened VNC on my pi, clicked options and added the relevant user.

Your Answer

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

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