How to grant read write access to a different notebooks HDD/SSD on Ubuntu 22.04 which is Ext4 formatted
To grant read-write access to an external SSD/HDD on Ubuntu 22.04, you can follow these steps:
Connect the external SSD/HDD to your Ubuntu machine.
Open a terminal and enter the following command to identify the device name:
sudo fdisk -l
The output should list all the connected devices, including the external SSD/HDD. Identify the device name of the external SSD/HDD from the list. It should be something like /dev/sdX (where X is a letter).
Create a mount point for the external SSD/HDD by entering the following command:
sudo mkdir /media/<mount_point>
Replace with a name you prefer. This will be the folder where the external SSD/HDD will be mounted.
Grant ownership of the mount point to the current user by entering the following command:
sudo chown -R $USER:$USER /media/<mount_point>
Add an entry for the external SSD/HDD in the /etc/fstab file to ensure that it is mounted automatically when the system starts up. Open the /etc/fstab file with the following command:
sudo nano /etc/fstab
Add the following line at the end of the file:
/dev/sdX /media/<mount_point> ext4 defaults 0 0
Replace /dev/sdX with the device name of the external SSD/HDD that you identified in step 2, and with the name of the mount point that you created in step 3.
Save and close the /etc/fstab file by pressing Ctrl+X, then Y, and then Enter.
Mount the external SSD/HDD by entering the following command:
sudo mount -a
This should mount the external SSD/HDD to the mount point that you created in step 3.
Now, you should have read-write access to the external SSD/HDD on your Ubuntu 22.04 machine.