@@ -6,8 +6,12 @@ categories: [examples]
6
6
tags : [cli, ssh]
7
7
---
8
8
9
- User management, including passwords, SSH keys, remote authentication is
10
- available in the system authentication configuration context.
9
+ In this post we explore how to use the CLI to change a user's password
10
+ and set up SSH keys for authentication.
11
+
12
+ User management is available in the system authentication configuration
13
+ context and there is a dedicated ` change ` command available to simplify
14
+ the process:
11
15
12
16
```
13
17
admin@example:/> configure
@@ -18,23 +22,25 @@ Retype password:
18
22
admin@example:/config/system/authentication/user/admin/> leave
19
23
```
20
24
21
- The change password command starts an interactive dialogue that asks for
22
- the new password, with a confirmation, and then salts and encrypts the
23
- password with the default crypt algorithm. This is either sha512crypt
24
- or yescrypt depending on the build.
25
+ The ` change password ` command starts an interactive dialogue that asks
26
+ for the new password, with a confirmation, and then salts and encrypts
27
+ the password with the default crypt algorithm. Either sha512crypt or
28
+ yescrypt depending on the Infix build.
25
29
26
30
It is also possible to use the ` set password ... ` command. This allows
27
- setting an already hashed password. To manually hash a password, use
28
- the ` do password encrypt ` command. This launches the admin-exec command
29
- to hash, and optionally salt, your password. This encrypted string can
30
- then be used with the ` set password ... ` command.
31
+ setting an already hashed password, which is what you must do when
32
+ managing users over NETCONF or RESTCONF. To manually hash a password,
33
+ use the ` do password encrypt ` command. This launches the admin-exec
34
+ command to hash, and optionally salt, your password. This encrypted
35
+ string can then be used with the ` set password ... ` command.
31
36
32
37
> if you are having trouble thinking of a password, Infix comes with a
33
38
> ` password generate ` command in admin-exec context which generates
34
39
> random passwords using the UNIX command ` pwgen ` . Use the ` do ` prefix
35
40
> when inside any configuration context to access admin-exec commands.
36
41
{: .prompt-tip }
37
42
43
+
38
44
### SSH Public Key Login
39
45
40
46
When accessing the system remotely using SSH it is very useful to have
@@ -59,3 +65,26 @@ admin@example:/config/system/authentication/user/admin/authorized-key/jacky@host
59
65
> base64 encodes the public key data, so there is no need to use the
60
66
> text-editor command with ` authorized-key ` , set does the job.
61
67
{: .prompt-info }
68
+
69
+
70
+ ### User Permissions
71
+
72
+ As a side note, user permissions are handled by the [ Access Control
73
+ Model] [ 0 ] , in ` nacm ` configuration context. Essentially it allows
74
+ defining a set of groups which a user can be member of. At first boot a
75
+ single group exist: ` admin ` , which the default ` admin ` user is member
76
+ of.
77
+
78
+ To give another user administrator rights we add them to the ` admin `
79
+ group:
80
+
81
+ ```
82
+ admin@example:/config/> edit nacm group admin
83
+ admin@example:/config/nacm/group/admin/> set user-name jacky
84
+ admin@example:/config/nacm/group/admin/> leave
85
+ ```
86
+
87
+ Read more about [ user management] [ 1 ] in the official documentation.
88
+
89
+ [ 0 ] : https://datatracker.ietf.org/doc/html/rfc8341
90
+ [ 1 ] : https://github.com/kernelkit/infix/blob/main/doc/system.md#multiple-users
0 commit comments