6

On Raspberry Pi, I log in as the default user Pi.

I do a sudo git clone on a repository, because it needs to create directories.

This is specific for DNU/DNX, because we cannot run sudo dnu restore yet, or ever? I don't know. It gets permission denied on the packages file causing it to error and I cant run the sample.

pi@raspberrypi ~/Home/samples/1.0.0-beta4/HelloMvc $ dnu restore
Restoring packages for /home/pi/Home/samples/1.0.0-beta4/HelloMvc/project.json
Writing lock file /home/pi/Home/samples/1.0.0-beta4/HelloMvc/project.lock.json
----------
System.UnauthorizedAccessException: Access to the path "/home/pi/Home/samples/1.0.0-beta4/HelloMvc/project.lock.json" is denied.

I had to do a chmod -R 0777 /Samples but that obviously is not the correct way to fix this.

How can I safely or easily use sudo git clone but then make everything as if Pi user did the clone, or allow the Pi user to work properly.

I did try chmod Pi:Pi on the specific packages file but that didn't help. I didn't try it recursively but I don't really know how to do this properly.

So I did a fresh clone as requested in comments, let see whats going on.

pi@raspberrypi /home/test $ sudo git clone https://github.com/aspnet/Home.git

pi@raspberrypi /home/test $ stat /home/test/Home
  File: `/home/test/Home'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: b302h/45826d    Inode: 153225      Links: 4
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-06-23 20:42:42.819728005 +0000
Modify: 2015-06-23 20:42:48.649688508 +0000
Change: 2015-06-23 20:42:48.649688508 +0000
 Birth: -

pi@raspberrypi /home/test $ stat /home/test
  File: `/home/test'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: b302h/45826d    Inode: 153224      Links: 3
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-06-23 20:42:31.099806322 +0000
Modify: 2015-06-23 20:42:42.819728005 +0000
Change: 2015-06-23 20:42:42.819728005 +0000
 Birth: -

pi@raspberrypi /home/test $ stat /home/pi
  File: `/home/pi'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: b302h/45826d    Inode: 29          Links: 7
Access: (0755/drwxr-xr-x)  Uid: ( 1000/      pi)   Gid: ( 1000/      pi)
Access: 2015-02-16 15:09:21.453774622 +0000
Modify: 2015-06-23 19:33:46.613016792 +0000
Change: 2015-06-23 19:33:46.613016792 +0000
 Birth: -

1 Answers1

11
sudo chown -R user:user path

This recursively changes the owner and group of everything under path to user.

Olathe
  • 4,310
  • 2
  • 19
  • 24
rkeatin3
  • 126
  • 1
  • 3