forked from OctoPrint/CustoPiZer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path01-make-pioreactor-user.sh
41 lines (30 loc) · 1.13 KB
/
01-make-pioreactor-user.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -x
set -e
export LC_ALL=C
source /common.sh
install_cleanup_trap
SSH_DIR=/home/pioreactor/.ssh
adduser --gecos "" --disabled-password pioreactor
chpasswd <<<"pioreactor:raspberry"
usermod -a -G sudo pioreactor
usermod -a -G gpio pioreactor
usermod -a -G spi pioreactor
usermod -a -G i2c pioreactor
usermod -a -G www-data pioreactor
usermod -a -G video pioreactor
usermod -a -G dialout pioreactor
usermod -a -G systemd-journal pioreactor
usermod -a -G avahi pioreactor
usermod -a -G netdev pioreactor
chmod 755 /home/pioreactor
# make sure pioreactor doesn't require a password when running as sudo
echo 'pioreactor ALL=(ALL) NOPASSWD: ALL' | sudo EDITOR='tee -a' visudo -f /etc/sudoers.d/010_pioreactor-nopasswd
# change default password for the pi user, as per RPi Foundations recommendation. Not sure if this works...
chpasswd <<<"pi:notaraspberry"
rm /etc/ssh/sshd_config.d/rename_user.conf
##### set some SSH stuff, populated on firstboot.
sudo -u pioreactor rm -rf $SSH_DIR # remove if already exists.
sudo -u pioreactor mkdir -p $SSH_DIR
sudo cp /files/ssh_config $SSH_DIR/config
sudo chown pioreactor:pioreactor $SSH_DIR/config