S
S
sergei-andreev2019-07-08 00:18:27
linux
sergei-andreev, 2019-07-08 00:18:27

How to edit files created by root in linux?

The problem is this: I created a folder with files using sudo react-create-app (I didn’t install it without sudo), after which I can’t edit anything in it without root rights (including through VS Code). How to work properly in linux? Google doesn't help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pfg21, 2019-07-08
@sergei-andreev

A folder/file without sudo is not created if the folder in which it is created has permissions that restrict the entry of a simple user.
after creating a folder from under the root, you need to change the rights (chmod) or the owner of the folder (chown) on the created folder from under the root. after this, inside the newly created folder, you can already safely work as a normal user.
example: /home is owned by root:root and has rights rwxr-x-rx i.e. only root can write to it, the rest can only be read.
for a newly created user, a user folder is created from under root and from under root the user is registered as the owner of the folder - after that, the user can do anything inside his folder.
in your case, you need to change the owner of the created folder to the one who will play in it (you or the user from whom react works, as I understand it) or set the rights to rwxrwxrwx i.e. everyone is allowed to do whatever they want (but it's less secure).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question