1 ---
2 title: npm-access
3 section: 1
4 description: Set access level on published packages
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-access.md
8 redirect_from:
9 - /cli-commands/access
10 - /cli-commands/npm-access
11 - /cli-documentation/access
12 - /cli-documentation/cli-commands/access
13 - /cli-documentation/cli-commands/npm-access
14 - /cli-documentation/commands/access
15 - /cli-documentation/commands/npm-access
16 - /cli-documentation/npm-access
17 - /cli-documentation/v10/access
18 - /cli-documentation/v10/cli-commands/access
19 - /cli-documentation/v10/cli-commands/npm-access
20 - /cli-documentation/v10/commands/access
21 - /cli-documentation/v10/commands/npm-access
22 - /cli-documentation/v10/npm-access
23 - /cli/access
24 - /cli/cli-commands/access
25 - /cli/cli-commands/npm-access
26 - /cli/commands/access
27 - /cli/commands/npm-access
28 - /cli/npm-access
29 - /cli/v10/access
30 - /cli/v10/cli-commands/access
31 - /cli/v10/cli-commands/npm-access
32 - /cli/v10/commands/access
33 - /cli/v10/npm-access
34 - /commands/access
35 - /commands/npm-access
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm access list packages [<user>|<scope>|<scope:team>] [<package>]
42 npm access list collaborators [<package> [<user>]]
43 npm access get status [<package>]
44 npm access set status=public|private [<package>]
45 npm access set mfa=none|publish|automation [<package>]
46 npm access grant <read-only|read-write> <scope:team> [<package>]
47 npm access revoke <scope:team> [<package>]
48 ```
49
50 Note: This command is unaware of workspaces.
51
52 ### Description
53
54 Used to set access controls on private packages.
55
56 For all of the subcommands, `npm access` will perform actions on the packages in the current working directory if no package name is passed to the subcommand.
57
58 - public / restricted (deprecated): Set a package to be either publicly accessible or restricted.
59
60 - grant / revoke (deprecated): Add or remove the ability of users and teams to have read-only or read-write access to a package.
61
62 - 2fa-required / 2fa-not-required (deprecated): Configure whether a package requires that anyone publishing it have two-factor authentication enabled on their account.
63
64 - ls-packages (deprecated): Show all of the packages a user or a team is able to access, along with the access level, except for read-only public packages (it won't print the whole registry listing)
65
66 - ls-collaborators (deprecated): Show all of the access privileges for a package. Will only show permissions for packages to which you have at least read access. If `<user>` is passed in, the list is filtered only to teams _that_ user happens to belong to.
67
68 - edit (not implemented)
69
70 ### Details
71
72 `npm access` always operates directly on the current registry, configurable from the command line using `--registry=<registry url>`.
73
74 Unscoped packages are _always public_.
75
76 Scoped packages _default to restricted_, but you can either publish them as public using `npm publish --access=public`, or set their access as public using `npm access public` after the initial publish.
77
78 You must have privileges to set the access of a package:
79
80 - You are an owner of an unscoped or scoped package.
81 - You are a member of the team that owns a scope.
82 - You have been given read-write privileges for a package, either as a member of a team or directly as an owner.
83
84 If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on the command line.
85
86 If your account is not paid, then attempts to publish scoped packages will fail with an HTTP 402 status code (logically enough), unless you use `--access=public`.
87
88 Management of teams and team memberships is done with the `npm team` command.
89
90 ### Configuration
91
92 #### `json`
93
94 - Default: false
95 - Type: Boolean
96
97 Whether or not to output JSON data, rather than the normal output.
98
99 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
100
101 Not supported by all npm commands.
102
103 #### `otp`
104
105 - Default: null
106 - Type: null or String
107
108 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with `npm access`.
109
110 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
111
112 #### `registry`
113
114 - Default: "https://registry.npmjs.org/"
115 - Type: URL
116
117 The base URL of the npm registry.
118
119 ### See Also
120
121 - [`libnpmaccess`](https://npm.im/libnpmaccess)
122 - [npm team](/cli/v10/commands/npm-team)
123 - [npm publish](/cli/v10/commands/npm-publish)
124 - [npm config](/cli/v10/commands/npm-config)
125 - [npm registry](/cli/v10/using-npm/registry)