1 ---
2 title: npm-access
3 section: 1
4 description: Set access level on published packages
5 github_repo: npm/cli
6 github_branch: release/v6
7 github_path: docs/content/commands/npm-access.md
8 redirect_from:
9 - /cli-documentation/v6/access
10 - /cli-documentation/v6/cli-commands/access
11 - /cli-documentation/v6/cli-commands/npm-access
12 - /cli-documentation/v6/commands/access
13 - /cli-documentation/v6/commands/npm-access
14 - /cli-documentation/v6/npm-access
15 - /cli/v6/access
16 - /cli/v6/cli-commands/access
17 - /cli/v6/cli-commands/npm-access
18 - /cli/v6/commands/access
19 - /cli/v6/npm-access
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm access public [<package>]
26 npm access restricted [<package>]
27
28 npm access grant <read-only|read-write> <scope:team> [<package>]
29 npm access revoke <scope:team> [<package>]
30
31 npm access 2fa-required [<package>]
32 npm access 2fa-not-required [<package>]
33
34 npm access ls-packages [<user>|<scope>|<scope:team>]
35 npm access ls-collaborators [<package> [<user>]]
36 npm access edit [<package>]
37 ```
38
39 ### Description
40
41 Used to set access controls on private packages.
42
43 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.
44
45 - public / restricted: Set a package to be either publicly accessible or restricted.
46
47 - grant / revoke: Add or remove the ability of users and teams to have read-only or read-write access to a package.
48
49 - 2fa-required / 2fa-not-required: Configure whether a package requires that anyone publishing it have two-factor authentication enabled on their account.
50
51 - ls-packages: 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)
52
53 - ls-collaborators: 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.
54
55 - edit: Set the access privileges for a package at once using `$EDITOR`.
56
57 ### Details
58
59 `npm access` always operates directly on the current registry, configurable from the command line using `--registry=<registry url>`.
60
61 Unscoped packages are _always public_.
62
63 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.
64
65 You must have privileges to set the access of a package:
66
67 - You are an owner of an unscoped or scoped package.
68 - You are a member of the team that owns a scope.
69 - You have been given read-write privileges for a package, either as a member of a team or directly as an owner.
70
71 If you have two-factor authentication enabled then you'll have to pass in an otp with `--otp` when making access changes.
72
73 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`.
74
75 Management of teams and team memberships is done with the `npm team` command.
76
77 ### See Also
78
79 - [`libnpmaccess`](https://npm.im/libnpmaccess)
80 - [npm team](/cli/v6/commands/npm-team)
81 - [npm publish](/cli/v6/commands/npm-publish)
82 - [npm config](/cli/v6/commands/npm-config)
83 - [npm registry](/cli/v6/using-npm/registry)