0

This question already has an answer here:

New to using CLI OS.

So I tried changing the owner of a particular folder from root to my user so I can avoid errors of access denied whenever I would publish my dotnet app.

Basically, this is the folder structure.

myAppFolder
 |
 ->myApp
   |
   ->All forders that make the app(folders, .cs, .sln and the likes)
   ->publish
   ->README.md

When I use ls -lart on myAppFolder it says that the owner is the root. Though when I go inside and ls -lart in it some files/folders' owner is my user already. I figured that if I use 'sudo chown -R user myAppFolder' it should also change the owner of all it's subfolders because of the recursive flag. (Correct me if I'm wrong.) But when I did execute the command the ownership did not change to my user. Is there something I'm missing here? Is my understanding of the used command wrong?

EDIT: The referenced Change folder permissions and ownership is where I actually got the command I used, I just edited it to 'sudo chown -R user myAppFolder' because I was already in the folder that contained myAppfolder which is /apps.

marked as duplicate by karel, user535733, Kulfy, waltinator, Eric Carvalho May 18 at 21:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    sudo chown -R $USER:$USER myAppFolder - Formore see: askubuntu.com/questions/6723/… – cmak.fr May 16 at 4:59
  • Probably immutable bit is set for some of your files/directories, if this is the case, you'd have to remove the immutable bit first. Use lsattr to see file attributes and chattr -i. Take a look at the related man pages, man lsattr and man chattr – mook765 May 16 at 8:19
  • @mook765 so the only way for me to change the owner of that particular file is to remove it and recreate it, is that correct? – vhie May 16 at 9:58
  • @vhie No, if the immutable bit is set you need to remove the immutable bit first, then you can make changes to the file. But I don't know if that's the case here, you never provided any meaningful output from ls -l or lsattr. So how can we know? – mook765 May 16 at 10:55
  • @mook765 so this is how it looks when I did the lsattr. prntscr.com/npm92m – vhie May 17 at 2:23
0

try this command in your terminal

sudo chown -R $USER:$USER /path/to/myAppFolder 

this is duplicate of this question Change folder permissions and ownership

  • 1
    You need to cd to the directory containing myAppFolder first. Or use absolute path. – mook765 May 16 at 6:57
  • @GHOST what is the difference in using a single $USER in using $USER:$USER? – vhie May 16 at 7:53
  • 1
    @vhie Using $USER:$USER will also change the group while using $USER will only change the owner. – mook765 May 16 at 7:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.