How to use Nuget in user after accidentally downloading it with sudo

Problem occurs

        During the collaborative development process, the nuget grpc package was added to dotnet at the same time, and the automatic generation script was executed without knowing it. The download of the nuget package failed, saying that the permissions were insufficient, so I used sudo to automatically generate it, and the result was the next time. During the repackaging process, protoc reported "Permission denied". After checking, it was because the permissions were different.

Approach

Modify file permissions

First, let’s check the permissions:

ls -lOw /path/to/folder  

Then you will get the following results

-rw-r--r--  1 root  staff  1024 Mar 24 12:34 /path/to/folder

As shown here, the user to whom the folder belongs is root, and the group to which it belongs is staff.

In this case, you can tell that the folder has administrator rights because there is an "Administrator" after the username.

We use chown to set the current folder to the current user. Assume that the current user is named test.

chown test:staff /path/to/folder  
//chown username:group /path/to/folder  

At this time, the current folder is set to test user permissions.

It can be used normally.

Guess you like

Origin blog.csdn.net/u013379032/article/details/131983467