You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This step is optional, but it's a good idea to give services like Home Assistant their own user. It gives you more granular control over permissions, and reduces the exposure to the rest of your system in the event there is a security related bug in Home Assistant. This is a reasonably Linux oriented step, and will look different on other operating systems (or even other Linux distributions).
28
28
29
29
```bash
30
-
$ sudo adduser --system hass
30
+
$ sudo adduser --system homeassistant
31
31
```
32
32
33
-
Home Assistant stores its configuration in `$HOME/.homeassistant` by default, so in this case, it would be in `/home/hass/.homeassistant`
33
+
Home Assistant stores its configuration in `$HOME/.homeassistant` by default, so in this case, it would be in `/home/homeassistant/.homeassistant`
34
34
35
35
If you plan to use a Z-Wave controller, you will need to add this user to the `dialout` group
36
36
37
37
```bash
38
-
$ sudo usermod -G dialout -a hass
38
+
$ sudo usermod -G dialout -a homeassistant
39
39
```
40
40
41
41
### {% linkable_title Step 2: Create a directory for Home Assistant %}
42
42
43
-
This can be anywhere you want. AS example we put it in `/srv`. You also need to change the ownership of the directory to the user you created above (if you created one).
43
+
This can be anywhere you want. As example we put it in `/srv`. You also need to change the ownership of the directory to the user you created above (if you created one).
44
44
45
45
```bash
46
-
$ sudo mkdir /srv/hass
47
-
$ sudo chown hass /srv/hass
46
+
$ sudo mkdir /srv/homeassistant
47
+
$ sudo chown hass /srv/homeassistant
48
48
```
49
49
50
50
### {% linkable_title Step 3: Become the new user %}
51
51
52
-
This is obviously only necessary if you created a `hass` user, but if you did, be sure to switch to that user whenever you install things in your virtualenv, otherwise you'll end up with mucked up permissions.
52
+
This is obviously only necessary if you created a `homeassistant` user, but if you did, be sure to switch to that user whenever you install things in your virtualenv, otherwise you'll end up with mucked up permissions.
53
53
54
54
```bash
55
-
$ sudo su -s /bin/bash hass
55
+
$ sudo su -s /bin/bash homeassistant
56
56
```
57
57
58
-
The `su` command means 'switch' user. We use the '-s' flag because the `hass` user is a system user and doesn't have a default shell by default (to prevent attackers from being able to log in as that user).
58
+
The `su` command means 'switch' user. We use the '-s' flag because the `homeassistant` user is a system user and doesn't have a default shell by default (to prevent attackers from being able to log in as that user).
59
59
60
60
### {% linkable_title Step 4: Set up the virtualenv %}
61
61
62
-
All this step does is stick a Python environment in the directory we're using. That's it. It's just a directory. There's nothing 'special' about it, and it is entirely self-contained.
62
+
All this step does is stick a Python environment in the directory we're using. That's it. It's just a directory. There's nothing special about it, and it is entirely self-contained.
63
63
64
64
It will include a `bin` directory, which will contain all the executables used in the virtualenv (including hass itself). It also includes a script called `activate` which we will use to activate the virtualenv.
65
65
66
66
```bash
67
-
$ virtualenv -p python3 /srv/hass
67
+
$ virtualenv -p python3 /srv/homeassistant
68
68
```
69
69
70
70
### {% linkable_title Step 5: Activate the virtualenv %}
71
71
72
72
```bash
73
-
$ source /srv/hass/bin/activate
73
+
$ source /srv/homeassistant/bin/activate
74
74
```
75
75
76
76
After that, your prompt should include `(hass)`.
@@ -83,17 +83,17 @@ Once your virtualenv has been activated, you don't need to `sudo` any of your `p
83
83
(hass)$ pip3 install --upgrade homeassistant
84
84
```
85
85
86
-
And that's it... you now have Home Assistant installed, and you can be sure that every bit of it is contained in `/srv/hass`.
86
+
And that's it... you now have Home Assistant installed, and you can be sure that every bit of it is contained in `/srv/homeassistant`.
87
87
88
88
### {% linkable_title Finally... Run Home Assistant %}
89
89
90
90
There are two ways to launch Home Assistant. If you are **in** the virtualenv, you can just run `hass` and it will work as normal. If the virtualenv is not activated, you just use the `hass` executable in the `bin` directory mentioned earlier. There is one caveat... Because Home Assistant stores its configuration in the user's home directory, we need to be the user `hass` user or specify the configuration with `-c`.
0 commit comments