LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-09-2023, 12:33 AM   #1
arfon
Member
 
Registered: Apr 2004
Distribution: Slackware & RHEL
Posts: 376

Rep: Reputation: Disabled
Portable drive permissions?


I wiped my portable harddrive and when I went to remount it as USER, it's not writeable.

/dev/sdc1 ---> /run/media/blah/123blahblah567/
When I ls -l /run/media/blah/123blahblah567 it's RWX------

This got me to thinking (since I have never really had to do this before):
What is the most Slackware correct way to set ownership and permissions on portable drives?

Do I CHOWN/CHMOD /dev/sdc1 ?
Do I CHOWN/CHMOD /media/run/blah ?
Do I CHOWN/CHMOD /media/run/blah/123blahblah567 ?
 
Old 08-09-2023, 03:17 AM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,506

Rep: Reputation: Disabled
Usually, you would
Code:
(sudo)chown -R yourname:yourgroup /media/run/blah/123blahblah567
Because that is where it is mounted.

https://www.man7.org/linux/man-pages/man1/chown.1.html

Last edited by fatmac; 08-09-2023 at 03:21 AM.
 
Old 08-09-2023, 03:29 AM   #3
BrunoLafleur
Member
 
Registered: Apr 2020
Location: France
Distribution: Slackware
Posts: 405

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
When you insert a removable disk, it is managed with udev.

On Slackware the udev rules for it are by default in private access for the user logged in.

You should not correct the permissions by hand with chmod and chown for those devices. It probably won't work.

If you want shared mounts, you can change the default in an udev rule above the default one in /usr/lib*/udev

The change will work with all removable devices. Or else select the one you want in the udev rule.

Else you can also mount with :
> udisksctl mount -b /dev/XXX in a console with your other user logged.
Unmount with :
> udisksctl unmount -b /dev/XXX

=========
/etc/udev/rules.d/99-udisks2.rules

# UDISKS_FILESYSTEM_SHARED
# ==1: mount filesystem to a shared directory (/media/VolumeName)
# ==0: mount filesystem to a private directory (/run/media/$USER/VolumeName)
# See udisks(8)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="0"

Last edited by BrunoLafleur; 08-09-2023 at 03:31 AM.
 
2 members found this post helpful.
Old 08-09-2023, 03:39 AM   #4
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,407

Rep: Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140Reputation: 4140
What is the return of the command:
Code:
$ id
?

You need to be in "plugdev" group

Last edited by marav; 08-09-2023 at 03:42 AM.
 
1 members found this post helpful.
Old 08-09-2023, 07:44 AM   #5
baumei
Member
 
Registered: Feb 2019
Location: USA; North Carolina
Distribution: Slackware 15.0 (replacing 14.2)
Posts: 365

Rep: Reputation: 124Reputation: 124
What do you mean by "wiped":
Quote:
Originally Posted by arfon View Post
I wiped my portable harddrive and when I went to remount it as USER, it's not writeable.
[snip]
If I were to say I "wiped a hard-drive", then the hard-drive would have NO partitions, and no formatting, and every byte would have been over-written at least once.

Last edited by baumei; 08-09-2023 at 07:47 AM.
 
Old 08-09-2023, 10:14 AM   #6
arfon
Member
 
Registered: Apr 2004
Distribution: Slackware & RHEL
Posts: 376

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by BrunoLafleur View Post
When you insert a removable disk, it is managed with udev.
I completely forgot about udev. I'm so used to not messing with this that I forgot how it works. Thanks!

This is why I ask you guys stuff.



Quote:
Originally Posted by baumei View Post
What do you mean by "wiped":What do you mean by "wiped":
I meant that I reformatted the partition.
 
Old 08-09-2023, 12:56 PM   #7
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 990

Rep: Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674
Quote:
Originally Posted by arfon View Post
I meant that I reformatted the partition.
What file system did you choose when formatting? Some file systems does not care about the concept of users and groups. Other file systems lets you choose owner at formatting (default root).

regards Henrik
 
Old 08-13-2023, 04:31 AM   #8
arfon
Member
 
Registered: Apr 2004
Distribution: Slackware & RHEL
Posts: 376

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by henca View Post
What file system did you choose when formatting?
Ext4. All of my portable drives (not thumb drives) are Ext4.

I have a few Windows machines but, there's nothing on them except games so I don't bother to back them up.


My Linux boxes.... I have quite a few so, I back them up on Ext4 portable drives.

Last edited by arfon; 08-14-2023 at 04:33 PM.
 
Old 08-13-2023, 05:11 AM   #9
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,754

Rep: Reputation: Disabled
Have you unplugged it without unmounting it first?
That's probably set the dirty bit so it now mounts with -o ro and you may have to run fsck on it before mounting it with -o rw again.
 
1 members found this post helpful.
Old 08-13-2023, 02:11 PM   #10
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 990

Rep: Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674
Quote:
Originally Posted by arfon View Post
Ext4. All of my portable drives (not thumb drives) are Ext4.
Unless you give some special options to mke2fs, by default the ext4 file system will be owned by root and only the root user will have write access to the top level directory. This is even if you created the file system as a normal user. However, if you give the option:

Code:
mke2fs -t ext4 -E root_owner ...
The top level directory will be owned by the user that created the file system. Be aware that when moving a portable drive like this between different systems those systems need to have /etc/passwd and /etc/group syncronized in some way, manually or with a service like NIS or LDAP to have the same point of view of which user has which numerig uid and which group has which gid.

regards Henrik
 
1 members found this post helpful.
Old 08-14-2023, 04:37 PM   #11
arfon
Member
 
Registered: Apr 2004
Distribution: Slackware & RHEL
Posts: 376

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by elcore View Post
Have you unplugged it without unmounting it first?
I'm really good about umounting soooo, probably not. But, you may be right, I may have slipped. I was doing ALOT of drive swapping that day.



Quote:
Originally Posted by henca View Post
Unless you give some special options to mke2fs, by default the ext4 file system will be owned by root and only the root user will have write access to the top level directory.
Good point... 99% of the time I'm root when using these drives. They are my backup drives and I always rsync as root to/from these. Now, I can't remember if I was USER when this happened. I may have been.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How? Run portable apps like firefox on seperate drive [Storage Drive] "USB" "HDD" "SSD" ? abc123xyz Slackware 5 03-25-2019 07:55 AM
[SOLVED] Permissions Permissions Permissions! makem Linux - Newbie 13 07-30-2015 11:54 AM
using flash drive/portable hard drive on BOTH Linux and Windows yankeegirl Linux - Hardware 2 10-07-2009 08:22 AM
need a portable linux distro to bring on portable usb hard drive... pippo17 Linux - Distributions 3 10-20-2008 06:41 AM
LXer: EDGE Tech Corp Announces Portable Flash Drive With Muscle - the New 8GB DiskGO!(TM) Now Available; Swap and Go With This Secure Thumb-Sized Flash Drive LXer Syndicated Linux News 0 12-14-2005 02:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration