Skip to content

Commit e1fc651

Browse files
committed
Update, clarify and mention user permissions
Also, link to official documentation. Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 3dcc3dd commit e1fc651

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

_posts/2024-07-25-passwordless-login.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ categories: [examples]
66
tags: [cli, ssh]
77
---
88

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:
1115

1216
```
1317
admin@example:/> configure
@@ -18,23 +22,25 @@ Retype password:
1822
admin@example:/config/system/authentication/user/admin/> leave
1923
```
2024

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.
2529

2630
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.
3136

3237
> if you are having trouble thinking of a password, Infix comes with a
3338
> `password generate` command in admin-exec context which generates
3439
> random passwords using the UNIX command `pwgen`. Use the `do` prefix
3540
> when inside any configuration context to access admin-exec commands.
3641
{: .prompt-tip }
3742

43+
3844
### SSH Public Key Login
3945

4046
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
5965
> base64 encodes the public key data, so there is no need to use the
6066
> text-editor command with `authorized-key`, set does the job.
6167
{: .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

Comments
 (0)