[SOLVED] Changing ownership/writing to ext4 USB drive
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a 4GB USB drive which I used fdisk to format using ext4. Now I can't write to the drive. I have tried chown and chmod to change permissions but I still get permission denied. To be clear, I used:
I thought it was something minor - Skaendo, I think you gave me the nudge in the direction I needed.
I tried what you suggested earlier but I just got an error saying the directory didn't exist.
Turns out that the terminal window [when I tried earlier] was not wide enough and as a result lsblk was not printing some of the drive characters [i.e. not just not displaying, but not printing].
e.g.
Code:
lysander@lysurfer_viii:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
|-sda1 8:1 0 28G 0 part /
|-sda2 8:2 0 1K 0 part
|-sda5 8:5 0 2G 0 part [SWAP]
`-sda6 8:6 0 203G 0 part /home
sdb 8:16 1 3.8G 0 disk /run/media/lysander/9f73a14b-0397-41de-bcd3-7b4b6
lysander@lysurfer_viii:~$
extending window
Code:
lysander@lysurfer_viii:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
|-sda1 8:1 0 28G 0 part /
|-sda2 8:2 0 1K 0 part
|-sda5 8:5 0 2G 0 part [SWAP]
`-sda6 8:6 0 203G 0 part /home
sdb 8:16 1 3.8G 0 disk /run/media/lysander/9f73a14b-0397-41de-bcd3-7b4b68897711
lysander@lysurfer_viii:~$
I used your command and the drive unlocked. I can now write to it, thank you.
For future reference, with linux filesystems like ext4 you change permissions on the moutpoint not the device file to change access permissions on the filesytem. Skaendo's suggestion should work. If not, it's probably because you formatted the raw block device, sdb and did not create a partition on sdb beforehand. That works OK in some environments but can cause problems in others.
Now, since this device is owned by the user lysander, can it be read/written by any other Linux user on another machine or is the ownership change specific to the Slack install? I'll try to read it from my Debian install which also has the user lysander.
You can run into problems going from one distro to anther even if you're using the same username. That's because linux looks at the numerical user id(uid) to determine access permissions. Debian and Ubuntu based distros all assign the first user created a uid of 1000 whereas Redhat, Mageia, Fedora and other historically RH based distros all assign the first user created a uid of 500. I don't know what Slackware does by default but you can find out by running:
Code:
$ id
It's very annoying for disto hoppers because a username may have access in a Debian based distro and the same user will be denied access in an RH based distro because of the differing uids. The easiest way around the problem is to use chmod to give the world rw access instead of chown which will limit access to a given uid. The downside is the security implications of giving world rw access to the drive. To give the world rw access you would run the following with the deivce mounted:
Thanks kilgoretrout, I'll use chmod if I run into problems. If anyone's interested I used the USB drive with Debian and it works, I can read from and write to it. So this has worked out rather nicely.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.