Non-auto ownership of HDD's

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.


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


@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 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.