Non-auto ownership of HDD's

Are you a troll or just crazier than I am? :crazy_face:

unfortunately when it comes to computers i am mostly self taught, so descriptions via annology is sometimes the only means of communcation left for complex issues.

I’m self taught too.

You plug the drives in, boot up and then…

Show us the exact commands you’re using to mount these drives, and any output, and ls -l the directory with your mountpoints in…

Then we can try to figure out what you’re talking about.

but we are now back tracking to something that has a solution even if i dont like it, however it is what it is:

Since i already have too format and partition everything i was hoping i could make things faster if the default policy that all new hard drives where automatically user controll (me) instead of root.

Ok, I just though we could maybe get something better worked out for you.

No wonder you’re having trouble. :grin:

It’s not a proper command, first of all it’s a combination of two commands man mount and sudo mount /dev/sdxN and do you have a dir called -path in the current directory. You’re running man with root for no reason and adding a block device for no reason.

Don’t put mountpoints in /run or /tmp since they’re temporary filesystems. No idea if you do this, since you won’t show the path.

for the sake of clarity:
I guess no one really knows what you are doing/trying to achieve quicker than you currently do.

I’m quite sure I don’t.

You have a lot of different drives regularly?
And you reformat and re-partition them?
And you then also want to use them?
But not as root but as a regular user?

That is where the chown step comes in …

But they are not in use for long.
Because then you change them again?
And the whole process starts again?

Or is it just the reformatting/repartitioning - possibly erasing/overwriting the previous content?

All these steps except the using them as a regular user require root access anyway, so … ?

2 Likes

as @Nachlese

  • format 300 disk with gparted ! bad: can use script

  • partition(s?) - only data ? if yes, you can force ID (1000) or GID (users) in same script and use also mask and acl

  • you want copy datas from manjaro to this 300 disk ? copy with ???

  • same disk content or not ?

  1. yes lots
  2. yes often
  3. they have to be returned usable so yes i have to be able to use them in (obviously since there so much patantic nature going on, not all 300 at once, like i said 5 at a time)
  4. when the drive is installed the machine is running, this new drive i do not want it too automatically make it root upon existing in connection to the machine as that would speed things up (well, what could be reasonably sped up), how i know root is in effect reguardless of the state of data on the drive or kind of data, or format. ALL require root to just deal with in any facit, until root is dealt with the whole way until the end where chown can finally be allowed to be used. I just dont want to keep fighting with root the entire time.
  5. if i could get rid of chown or other repeate per drive permissions and ownership method that would also needs to go (well disabled)
    6-8. this is because i most of these drives are going back to non profit, friends, family, ect. like anything in life there is always stuff to be done.

using the script method would save me about the same time i wanted to avoid scripting because its too foreign to me (computer faster than human fingers lol, so i guess im just going to have to get over it and script it)

im not really asking for anything to be done about the (re)formating/(re)partitioning, ect that takes time to do that stuff and require sudo regardless this part takes time anyhow… no complaints here cant really shave much time out this spot due to varied requests its why im trying to avoid giving much detail about this section because its irrelvant beyond story/context.

Putting aside ownership/permissions, is your objective here just to mount them and write something on them to check they work?

1 Like

My questions where to elicit information on what you are actually trying to do, what the objective is that you are trying to achieve.
What is the overall goal?

Lots of disks - reformat and somehow test them? Then send them on their way?

sheer fact that a new disk drive being just plugged in existing (drive doesnt have to be doing anything, but in order to do anything requires root) in any fasct requires the use of su the level privileges is overkill. So the process before mounting is dumb it requires all diagnoistics (just to see if the device is registering as plugged) to run su (not sudo) , why? really why? does everyone here just throw in a harddrive into there system and format/partition without doing ANY premount work???

for example
the use of hwinfo for disks will not show “new” disk that have not been mounted unless you use su.

So you don’t want to be asked for password or switching to root :thinking: You can easily disable sudo password, grant yourself all root privileges (very bad ideas) or extend sudo timeout. But if you don’t know what you do – as I see you don’t know – it’s very, very bad idea.

does no one see a problem with new drives being under root account??? thats what su (well su is switch user, but if you dont clearify its root) is.

next even if it was sudo having to repeat because for some reason all “new” harddrives is overkill with no clear reason. Im currently looking up system wide permission list location see if then make a back up.

oh and this just dawned on me

I don’t see problem here. These things should always do as root – you never know what is on these disks, so it’s good idea have high security level.

2 Likes

oh god… root is the last place that should have direct access and interaction with malware ect.

if i remember correctly accounts are more sperated than windows, so malware is less harmfull on user account than on root account.

but yeah i have already selected solutions.

I don’t.

Linux is fundamentally a Unix - which is a multi user system by design.
In such a system you can’t just have anyone adding and removing hardware - system critical or not, or write to every place they please …

You still have not said what the final objective is - or confirmed that what we speculated was correct.
In this case this could all be easily scripted and even done without su or sudo every time.

good for you

2 Likes

@Rocherd87 How about you actually answer our questions, so we finally stand on the same page?

1 Like

I just have the commands on hand in a text file saved in a data partition automounted on all my distros, which all are uid+gid=1000 (I changed pclinuxos’ to 1000 as well).

If I have to chown or chmod something else, I (edit if necessary), copy and paste the commands into terminal.

I think the initial need for devices to be owned by root or for partitioning/formatting to only be done as root is a security precaution and should not be changed by default.

Note: my shared data partition is chowned to [myusername]:1000, with chmod at 755.

I am telling myself I understand your issue - correct me if I am wrong.

You have a heap of disks you want to recycle - giving them away for charity/friends/family.

You want to optimize your workflow and you want to make the disk ready for usage on any computer system it gets attached to.

If you are targeting both Linux and Windows - you will have to use a portable filesystem like exFAT or create an option for the script to format to a given filesystem.

It is not a good idea to initiate a partition/format process when the device is attached but it is fairly easy to create a script which takes a number of device names and a filesystem e.g.

$ sudo recycle.sh devices=sdm sdn sdo sdp sdq fs=exfat

For example you could refactor the script in this topic to handle you use case.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.