1# Account Manager
2
3
4Account Manager (acm) is a tool that provides basic capabilities of managing local accounts, such as creating, deleting, and querying accounts.
5
6> **NOTE**
7>
8> Before using this tool, you must obtain [hdc](../dfx/hdc.md) and run the **hdc shell** command.
9
10
11**Commands**
12
13| Command| Description|
14| -------- | -------- |
15| help | Displays the commands supported by acm.|
16| create | Creates an account. This command can be used only after the root permission is obtained.|
17| delete | Deletes an account. This command can be used only after the root permission is obtained.|
18| dump | Dumps the account information. This command can be used only after the root permission is obtained.|
19| switch | Switches accounts. This command can be used only after the root permission is obtained.|
20| deactivate | Deactivates an account. This command can be used only after the root permission is obtained.|
21| set | Sets constraints for an account. This command can be used only after the root permission is obtained.|
22
23
24## help
25
26**Usage**
27
28```bash
29acm help
30```
31
32**Return Result**
33
34The help information about acm.
35
36
37## create
38
39**Usage**
40
41```bash
42# Display the help information.
43acm create -h
44# Create an account with a specified name and type.
45acm create -n <accountName> -t <accountType> [-s <shortName>] [-l <disallowed-install-hap-list>]
46```
47
48**Return Result**
49
50If the account is created successfully, "create the local account successfully." is displayed. Otherwise, an error message is displayed.
51
52**Parameters of the Create Command**
53
54| Parameter                               | Description                      |
55| ----------------------------------- | -------------------------- |
56| -h | This parameter is optional. It is used to display the parameters supported by the **create** command.|
57| -n | This parameter is mandatory. It specifies the name of a new account. |
58| -t | This parameter is mandatory. It specifies the type of a new account, which can be **admin**, **normal**, **guest**, or **private**.|
59| -s | This parameter is optional. It specifies the short name of a new account.|
60| -l | This parameter is optional. It specifies the preset application blocklist of a new account.|
61
62
63## delete
64
65**Usage**
66
67```bash
68# Display the help information.
69acm delete -h
70# Delete an account with a specified ID.
71acm delete -i <accountId>
72```
73
74**Return Result**
75
76If the account is deleted successfully, "delete the local account successfully." is displayed. Otherwise, an error message is displayed.
77
78**Parameters of the Delete Command**
79
80| Parameter                               | Description                      |
81| ----------------------------------- | -------------------------- |
82| -h | This parameter is optional. It is used to display the parameters supported by the **delete** command.|
83| -i | This parameter is mandatory. It specifies the ID of the account to be deleted.|
84
85
86## dump
87
88**Usage**
89
90```bash
91# Display the help information.
92acm dump -h
93# Dump the information about all accounts.
94acm dump -a
95# Dump the information about an account with a specified ID.
96acm dump -i <accountId>
97```
98
99**Return Result**
100
101If the query is successful, the corresponding account information is displayed. Otherwise, an error message is displayed.
102
103**Parameters of the Dump Command**
104
105| Parameter                               | Description                      |
106| ----------------------------------- | -------------------------- |
107| -h | This parameter is optional. It is used to display the parameters supported by the **dump** command.|
108| -a | This parameter is mandatory. It is used to dump the information about all accounts.|
109| -i | This parameter is mandatory. It is used to dump the information about an account with a specified ID.|
110
111
112## switch
113
114**Usage**
115
116```bash
117# Display the help information.
118acm switch -h
119# Switch to an account with a specified ID.
120acm switch -i <accountId>
121```
122
123**Return Result**
124
125If the account is switched successfully, "switch the local account successfully." is displayed. Otherwise, an error message is displayed.
126
127**Parameters of the Switch Command**
128
129| Parameter                               | Description                      |
130| ----------------------------------- | -------------------------- |
131| -h | This parameter is optional. It is used to display the parameters supported by the **switch** command.|
132| -i | This parameter is mandatory. It specifies the ID of an account to be switched to.|
133
134
135## deactivate
136
137**Usage**
138
139```bash
140# Display the help information.
141acm deactivate -h
142# Deactivate all accounts.
143acm deactivate -a
144# Deactivate an account with a specified ID.
145acm deactivate -i <accountId>
146```
147
148**Return Result**
149
150If the account is deactivated successfully, "deactivate the local account successfully." is displayed. Otherwise, an error message is displayed.
151
152**Parameters of the Deactivate Command**
153
154| Parameter                               | Description                      |
155| ----------------------------------- | -------------------------- |
156| -h | This parameter is optional. It is used to display the parameters supported by the **deactivate** command.|
157| -a | This parameter is mandatory. It is used to deactivate all accounts.|
158| -i | This parameter is mandatory. It is used to deactivate an account with a specified ID.|
159
160
161## set
162
163**Usage**
164
165```bash
166# Display the help information.
167acm set -h
168# Set constraints for an account with a specified ID.
169acm set -i <accountId> -c <constraints> [-e]
170```
171
172**Return Result**
173
174If the constraint is set successfully, "set constraints for the local account successfully." is displayed. Otherwise, an error message is displayed.
175
176**Parameters of the Set Command**
177
178| Parameter                               | Description                      |
179| ----------------------------------- | -------------------------- |
180| -h | This parameter is optional. It is used to display the parameters supported by the **set** command.|
181| -i | This parameter is mandatory. It specifies an account ID.|
182| -c | This parameter is mandatory. It specifies the constraints to be set. Each constraint is separated by a comma (,). For details, see [Account Constraint List](../reference/apis-basic-services-kit/js-apis-osAccount.md#constraints).|
183| -e | This parameter is optional. If this parameter is carried, the command is used to add a constraint; otherwise, the command is used to delete a constraint.|
184