How best to change the 'ownership' of a whole drive or directory via 1 or a few commands?

Cody Smith cody.smith at ubuntu.com
Tue May 24 15:54:10 UTC 2016


Someone commandline utilities are the best tools for the job such as in
this case

On Mon, May 23, 2016, 4:11 AM Bas Roufs <basroufs at gmail.com> wrote:

> ISSUE SOLVED.
>
> Hello Xen, Nils and Everybody.
>
> Thanks for your advises - they worked out well for me.
>
> I have carried out the following commands:
>
> sudo -i
> (For getting into the root mode.)
>
> chown -R bas.bas /media/bas/Thuis
> (One of the external HD's.)
>
> chown -R bas.bas /media/bas/Thuishaven
> (Another external HD)
> chown -R bas.bas /home/bas/Desktop
>
> (Also that folder was owned by root.)
>
> However it may be - the above commands worked like a charm. It took less
> then 5 minutes per command.
>
> Yours.
>
> Bas.
>
>
> 2016-05-21 11:01 GMT+02:00 Xen <list at xenhideout.nl>:
>
>> Bas Roufs schreef op 21-05-2016 10:05:
>>
>>> Hello Everybody.
>>>
>>> Recently, I apparently made a mistake I can reconstruct only roughly.
>>> I tried to recover a few accidently deleted folders at 2 external HD's
>>> via 'photorec'. The recovery attempt was not reallly successful,
>>> however I it is no problem to get back the lost data in other ways.
>>>
>>> But another problem popped up. The 'ownership' of my external HD's
>>> have changed from #normal-user-name to #root.
>>>
>>> Normally, I do manage to change the ownership of a whole external
>>> drive via kdesudo dolphin > properties. However,  this does not work
>>> now. Is there any commandline option to change back the ownership
>>> everything at /dev/sdb/ from #root to, in my case, #bas?
>>>
>>> A single folder OR file I can 'chown' via sudo mc. However, this does
>>> not work for  underlying folders and files.
>>>
>>
>> Mine!
>>
>> Normally it can depend on the way it is mounted, but not always.
>>
>> FAT32 volumes do not have any ownership, so the ownership they get is
>> that which is supplied at mount time. Normally if your user is in Kubuntu
>> (KDE) it would get the ID of your user.
>>
>> In other volumes you may not need to do more than a recursive chown:
>>
>> chown -R /root/of/tree
>>
>> so:
>>
>> chown -R youruser.yourgroup /root/of/tree
>>
>> would do the trick (as root, because a regular user cannot change
>> ownership of anything)
>>
>> It does not depend on /dev/sdb btw, you need to access the mount point.
>>
>> For vfat (and similar, such as remote "samba" mounts), you may need to
>> supply a uid on the mount command line (or in fstab).
>>
>>
>> --
>> kubuntu-users mailing list
>> kubuntu-users at lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
>>
>
>
>
> --
>
> Bas G. Roufs
>
> Utrecht, NL, E. BasRoufs at gmail.com; Mob. +31 6 446 835 10;
>
>
> --
> kubuntu-users mailing list
> kubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20160524/0789346f/attachment.html>


More information about the kubuntu-users mailing list