January 23, 2022

Read & write Linux, ext4, volumes with Windows & Mac

In an other post I explained how to access and edit the data on an USB attached drive with the Linux "standard" ext4 filesystem. 

In this post I will explain how to read, write or add files using Windows, File explorer, or Mac, Finder, without third party software !

You "just" need a Linux machine, but since you want to access an ext4 filesystem there probably are a machine in the surroundings ?

In this post I will use a "simple" Raspberry Pi(RPi) and the ext4 media attached to one of the USB ports.

Prerequisites
In a standard RPi installation you just have to add the Samba package using user "pi".

How to
With user "pi"
With the user "pi" added as a Samba user go on and create the directory for the coming mount.

$ mkdir drive


Attach the USB drive and mount it, according to these instructions, to the directory "drive". In my case

$ sudo mount /dev/sda2 drive


check with "ls -la drive" and then with your Windows/MacOS connect to the the RPi, with user "pi", and browse the Linux filesystem.

As you may notice you don't have full access to all the files on the drive and this is due to that the user which mounted the drive is "pi" and you have inherited those permissions.

With user "root"
If you want to have full permission to all the files we have to use "root". In RPi OS the "root" user isn't enabled for login so we have to start with, in the "pi" session, command

$ sudo passwd root

where you will set the password. Go on with, switch user, 

$ su root


and then 

$ cd /root

where you create the directory for the mount, "mkdir drive", and then mount "sudo mount /dev/sda2 drive". Check with "ls -la drive".

Add user "root" as a samba user, "sudo pdbedit -a root", restart Samba and then with your Windows/MacOS connect to the the RPi, with user "root", and browse the Linux filesystem.

Wrap up
If you want to disable the login for root use "sudo passwd -dl root"

Enable ssh for root 

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !