0

I have Ubuntu WSL with default username wsl and new user with username newuser

List all files :

wsl@Optiplex:~$ ls -la
total 176
drwxr-xr-x 13 wsl  wsl    4096 Nov  1 06:36 .
drwxr-xr-x  4 root root   4096 Oct  3 03:09 ..
drwxr-x---  2 wsl  wsl    4096 Sep 27 20:29 .android
-rw-------  1 wsl  wsl  101618 Nov  1 04:38 .bash_history
-rw-r--r--  1 wsl  wsl     220 Sep  4 14:11 .bash_logout
-rw-r--r--  1 wsl  wsl    3771 Sep  4 14:11 .bashrc
drwx------  2 wsl  wsl    4096 Oct  9 21:42 .cache
drwx------  3 wsl  wsl    4096 Sep 14 01:05 .config
drwxr-xr-x  2 wsl  wsl    4096 Sep  4 14:11 .landscape
drwxr-xr-x  3 wsl  wsl    4096 Sep 14 02:26 .local
-rw-r--r--  1 wsl  wsl       0 Oct  9 21:31 .motd_shown

Then i add newuser to wsl group

usermod -aG wsl newuser 

But still permission denied.

newuser@Optiplex:/home/wsl$ ls .cache/
ls: cannot open directory '.cache/': Permission denied
newuser@Optiplex:/home/wsl$ touch test
touch: cannot touch 'test': Permission denied
newuser@Optiplex:/home/wsl$

id wsl : uid=1000(wsl) gid=1000(wsl) groups=1000(wsl),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev)

id newuser : uid=1001(newuser) gid=1001(newuser) groups=1001(newuser),1000(wsl)

What i must do for allow read and write in /home/wsl without chmod/chgrp/ change permission. thanks

Anas Fanani
  • 101
  • 1
  • Does the homework exercise allow the use of ACLs? – telcoM Nov 02 '22 at 17:26
  • q.v. getfacl and setfacl. – Hack Saw Nov 02 '22 at 17:36
  • "But still permission denied." -- yes, because the `wsl` _group_ doesn't have write access to `.`, or `r` (nor `x`) to `.cache`. – ilkkachu Nov 02 '22 at 18:26
  • "What i must do for allow read and write in /home/wsl without chmod/chgrp/ change permission." -- Drop that requirement and use `chmod` to change the permissions to what you need them to be. Or, if there's an actual reason for this requirement, it might make it easier to find a suitable solution for you if you could [edit] your question to tell what that reason is. – ilkkachu Nov 02 '22 at 18:28

0 Answers0