WSL file system permission mixed up with windows files - linux

I'm using WSL2 (Windows Subsystem for linux), and I've been using it for a really long time, and I didn't have troubles with it.
Unfortunately, today, from my linux distribution (Ubuntu 20.04), I no longer have permissions to view some Windows files, to which I had previously access without trouble. I don't know what happened, I don't remember intalling any update manually.
However, interestingly, I can access them if I do sudo su and become root. Then, I can access everything, or I can use sudo cat. But I don't want anything of that, I want to be the default WSL user to do what I could before.
What I tried:
Adding my default user to admin group, root group and sudo group (no luck)
Addming username to sudoers
root ALL=(ALL:ALL) ALL
danon ALL=(ALL:ALL) ALL
Editing permissions in my Windows host machine to allow everyone to access it
Editing permissions in my Windwos host to change the owner of the file (and directories below it)
Use other WSL distros, Ubuntu 20.04 and Ubuntu 18.04
Add metadata option to /etc/wsl.conf
Restarting the distro
Restarting the wsl
Restarting the host system
I don't know what else to do. I don't want to do sudo su everytime I open my wsl, or call each method with sudo.
I would like either to access my files from WSL like I used to before, or maybe specifically make those files available to my default linux user.
Result of mount:
C:\ on /mnt/c type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;metadata;umask=22;fmask=11;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8)
D:\ on /mnt/d type 9p (rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;metadata;umask=22;fmask=11;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8)

Related

Recover Windows Subsystem Root User Password for Linux

I use linux bash on my windows machine with developer mode windows subsystem setup for linux. I followed this guide to install and configure sudo: https://linuxhint.com/run-sudo-command-windows/ but I forgot my password and I don't know how to reset it. Since I don't use a GUI distribution of ubuntu I can't use the LIVE CD nor can I use the GRUP bootloader. What options do I have?

Ubuntu 22.04 - Nemo keeps owner and permissions unlike Ubuntu 20.04 - Undesirable behavior

Nemo file manager in Ubuntu 22.04 preserves owner and permissions during a copy-paste operation (GUI) from a user folder to a system folder unlike Ubuntu 20.04.
The behavior in Ubuntu 20.04 was much more comfortable than that of Ubuntu 22.04, in which from the terminal I am forced to restore the root owner and the default permissions for each file copied to a system folder.
Is there a way to tell Nemo to forget the original owner and permissions during a copy-paste operation, like it was for good old Ubuntu 20.04?

Can not log in Elementary after install ubuntu 18.04 (dual boot)

I am new to Ubuntu 18.04. It has been a long time that I have not updated anything new on my current OS which is Loki (interestingly, besides Loki does not allow ppl to upgrade Juno).
For some reasons, I have to install another Linux OS on my machine, which is ubuntu 18.04 - the minimal installation. Although everything works perfectly to Ubuntu, it makes me cannot log in to my main OS.
Description of an issue: After selecting a boot of elementary, I log in my account on a log-in page of Elementary. It does not show anything else and move back to the log-in. Another try with a guest account (with no password), still the same problem.
Because most of my data and work in Elementary, I have to find a way to solve this problem. Is there anyone here giving me a hand? Thank you very much.
I ran into same problem once.
Login into tty mode by Ctrl+Shift+F1,and enter:
sudo dpkg --configure -a
sudo apt-get install ecryptfs-utils
sudo reboot
And I was able to login
Trying tty mode by Ctrl+Shift+F1, I was able to log-in in a terminal. Turn out that the Ubuntu has used almost the left memory to load an OS. By removing some files by the command rm -rf [filename] to release around 2GB, I was able to have everything back. It was freaking for a while. Phewww...

VirtualBox: mounting shared folder fails during start-up, but succeed from shell

Problem description:
When I boot my VirtualBox Guest OS, the mounting of the shared file-system - which is referenced in /etc/fstab - fails.
However, after login - mount -a succeeds.
Details:
The boot process gets stuck here ...
... and pressing s continues the boot process, which finishes.
In the shell, I verify that my shared directory is not mounted:
But now, from the shell, the mount of the shared file-system succeeds:
What should I do to make my mount succeed during start-up?
Environment:
VirtualBox: 4.3.12.r93733
Host OS: Windows 7
Guest OS: Linux ubuntu 3.13.0-32-generic #57~precise1-Ubuntu x86_64 GNU/Linux
/etc/fstab
Relevant lines in /var/log/boot.log
You don't have to mount it, VitrualBox will make it for you. For me,these steps worked on my System (VirtualBox 5.0.10 on Windows 7 and Kubuntu 14.04 guest system):
In VirtualBox, configure your shared folder for your machine under 'Shared Folder'. Pick up the directory on your host system (e.g. D:\shared) and set a name for your guest system (e.g. shared).
Boot the guest system. Now you should have a mounted folder under \media\sf_shared.
Thats all. VirtualBox manages this for you.
You need to install VirtualBox Guest Additions properly and use VirtualBox Manager to specify share folders. The issue happens because the mount point is in place with root permissions. The default mount location is in /media/sf_.
You can change mount point with VBoxControl command. To change the mount point from /media/sf_... to /home/user/sf_... use the command:
sudo VBoxControl guestproperty set /VirtualBox/GuestAdd/SharedFolders/MountDir /home/user/
To check if that's working:
sudo VBoxControl guestproperty get /VirtualBox/GuestAdd/SharedFolders/MountDir

Samba, Apache and SVN. Getting the permissions right

I have two machines I work on:
Windows Client (Development Machine)
Linux Web Server (Ubuntu)
On the Linux server I have installed Apache, Samba and SVN.
I've created a samba share that maps to the htdocs/ directory so that I can access the web files from Windows.
The following illustrates my workflow:
From command line on Linux server I checkout working copies of web projects from remote server into my local Linux server's htdocs directory.
On the Windows machine I access these files (using samba) and edit them in my editor and test them in the web browsers
Back on the Linux machine I checkin my work to the remote server.
The problem I have is that currently for me to be able to edit the files on the Windows box via Samba I have to change the owner of the files to nobody (apache user) and set the Samba share to use SHARE permissions.
When I try to use SVN to commit and update etc. I can't because my Linux user is not 'nobody' and does not have permissions to do so. So I have to become root do an SVN [command] then change all the files back to 'nobody' so that I can't edit on Windows.
What I would like to be able to do is have the web files be owned by my local Linux user which would enable SVN commands to work and for Windows (over samba) to also use this same user.
How can I get this to work, is there a way to get Windows and Linux users to match?
Why use this strange workflow? A more logical one would be:
Checkout the files on the Windows Machine directly
Edit and test them
Check in when ready
Is there something special you need from the Linux server? Cant' you install apache on Windows (for testing purposes only?)
I've solved my problem by changing all the permissions to match and then using samba USER permissions and settings up a users.map file.

Resources